跳至内容

命令行

Prisma Client Python 与 Prisma CLI捆绑在一起,所有命令和参数都相同。您可以使用安装的控制台脚本调用 CLI

$ prisma db push

或者直接调用 Prisma Client Python 模块

$ python -m prisma db push

或者,如果由于任何原因失败,您也可以使用标准的 Node Prisma CLI(如果您安装了 npx

$ npx prisma generate

注意

这实际上与 Prisma Client Python 在幕后所做的事情非常相似,因为它会下载一个 Node 二进制文件并使用它来执行 Prisma CLI。

如果您自己使用 Node CLI,则自定义 python 命令不可用。但是,您仍然可以执行使用 Prisma CLI 通常执行的所有操作,包括生成 Python 客户端!

命令

Prisma Client Python 在 prisma 提供的命令之上添加了命令。

所有 python 命令必须以 py 为前缀

生成

添加了对修改 Prisma Client Python 架构 选项 的支持,而无需对您的 prisma 架构文件进行任何更改。

Usage: prisma py generate [OPTIONS]

Options:
  --schema FILE               The location of the Prisma schema file.
  --watch                     Watch the Prisma schema and rerun after a change
  --interface [sync|asyncio]  Method that the client will use to interface
                              with Prisma
  --partials PATH             Partial type generator location
  -t, --type-depth INTEGER    Depth to generate pseudo-recursive types to; -1
                              signifies fully recursive types
  --help                      Show this message and exit.

版本

显示 Prisma Client Python 版本信息。

Usage: prisma py version [OPTIONS]

Options:
  --json  Output version information in JSON format.
  --help  Show this message and exit.

获取

确保所有二进制文件都已下载并可用。

Usage: prisma py fetch [OPTIONS]

Options:
  --force  Download all binaries regardless of if they are already downloaded
           or not.
  --help   Show this message and exit.