snow spcs service deploy

Note

You can use Snowpark Container Services from Snowflake CLI only if you have the necessary permissions to use Snowpark Container Services.

部署项目定义文件中定义的服务。

语法

snow spcs service deploy
  <entity_id>
  --upgrade
  --project <project_definition>
  --env <env_overrides>
  --connection <connection>
  --host <host>
  --port <port>
  --account <account>
  --user <user>
  --password <password>
  --authenticator <authenticator>
  --workload-identity-provider <workload_identity_provider>
  --private-key-file <private_key_file>
  --token <token>
  --token-file-path <token_file_path>
  --database <database>
  --schema <schema>
  --role <role>
  --warehouse <warehouse>
  --temporary-connection
  --mfa-passcode <mfa_passcode>
  --enable-diag
  --diag-log-path <diag_log_path>
  --diag-allowlist-path <diag_allowlist_path>
  --oauth-client-id <oauth_client_id>
  --oauth-client-secret <oauth_client_secret>
  --oauth-authorization-url <oauth_authorization_url>
  --oauth-token-request-url <oauth_token_request_url>
  --oauth-redirect-uri <oauth_redirect_uri>
  --oauth-scope <oauth_scope>
  --oauth-disable-pkce
  --oauth-enable-refresh-tokens
  --oauth-enable-single-use-refresh-tokens
  --client-store-temporary-credential
  --format <format>
  --verbose
  --debug
  --silent
  --enhanced-exit-codes
  --decimal-precision <decimal_precision>

实参

entity_id

服务实体的 ID。

选项

--upgrade

更新现有服务。可以更新 min_instances、max_instances、query_warehouse、auto_resume、auto_suspend_secs、external_access_integrations 和 comment。默认值:False。

-p, --project TEXT

Snowflake 项目的存储路径。默认为当前工作目录。

--env TEXT

格式为 key=value 的字符串。替换用于模板的 env 部分的变量。默认值:[]。

--connection, -c, --environment TEXT

Name of the connection, as defined in your config.toml file. Default: default.

--host TEXT

连接的主机地址。替换为连接指定的值。

--port INTEGER

连接的端口。替换为连接指定的值。

--account, --accountname TEXT

分配给 Snowflake 账户的名称。替换为连接指定的值。

--user, --username TEXT

连接到 Snowflake 的用户名。替换为连接指定的值。

--password TEXT

Snowflake 密码。替换为连接指定的值。

--authenticator TEXT

Snowflake 身份验证器。替换为连接指定的值。

--workload-identity-provider TEXT

工作负载身份提供商(AWS、AZURE、GCP、OIDC)。替换为连接指定的值。

--private-key-file, --private-key-path TEXT

Snowflake 私钥文件路径。替换为连接指定的值。

--token TEXT

连接到 Snowflake 时使用的 OAuth 令牌。

--token-file-path TEXT

连接到 Snowflake 时使用的带有 OAuth 令牌的文件路径。

--database, --dbname TEXT

要使用的数据库。替换为连接指定的值。

--schema, --schemaname TEXT

要使用的数据库架构。替换为连接指定的值。

--role, --rolename TEXT

要使用的角色。替换为连接指定的值。

--warehouse TEXT

要使用的仓库。替换为连接指定的值。

--temporary-connection, -x

Uses a connection defined with command-line parameters, instead of one defined in config. Default: False.

--mfa-passcode TEXT

用于多重身份验证的令牌 (MFA)。

--enable-diag

是否生成连接诊断报告。默认值:False。

--diag-log-path TEXT

Path for the generated report. Defaults to system temporary directory. Default: <system_temporary_directory>.

--diag-allowlist-path TEXT

包含允许列表参数的 JSON 文件的路径。

--oauth-client-id TEXT

身份提供商为 Snowflake 集成提供的客户端 ID 的值。

--oauth-client-secret TEXT

身份提供商为 Snowflake 集成提供的客户端密钥的值。

--oauth-authorization-url TEXT

向驱动程序提供授权码的身份提供商端点。

--oauth-token-request-url TEXT

向驱动程序提供访问令牌的身份提供商端点。

--oauth-redirect-uri TEXT

URI 用于授权码重定向。

--oauth-scope TEXT

身份提供商授权请求中请求的范围。

--oauth-disable-pkce

Disables Proof Key for Code Exchange (PKCE). Default: False.

--oauth-enable-refresh-tokens

Enables a silent re-authentication when the actual access token becomes outdated. Default: False.

--oauth-enable-single-use-refresh-tokens

Whether to opt-in to single-use refresh token semantics. Default: False.

--client-store-temporary-credential

存储临时凭据。

--format [TABLE%JSON%JSON_EXT|CSV]

指定输出格式。默认:TABLE。

--verbose, -v

Displays log entries for log levels info and higher. Default: False.

--debug

Displays log entries for log levels debug and higher; debug logs contain additional information. Default: False.

--silent

关闭到控制台的中间输出。默认值:False。

--enhanced-exit-codes

根据错误类型区分退出错误代码。默认值:False。

--decimal-precision INTEGER

Number of decimal places to display for decimal values. Uses Python’s default precision if not specified. [env var: SNOWFLAKE_DECIMAL_PRECISION].

--help

Displays the help text for this command.

使用说明

The snow spcs service deploy command reads a snowflake.yml project definition file that defines a service, then creates and deploys the compute pool to a stage named in the snowflake.yml file. If your project definition has precisely one service entity, you can omit the <entity_id> argument. However, if your project definition has multiple service entities, you must specify the service name in the <entity_id> argument. For more information, see Services project definition.

您可以选择运行服务的多个实例。每个服务实例都是服务规范文件中定义的容器的集合,这些容器在计算池中的节点上一起运行。如果您选择运行服务的多个实例,负载平衡器将管理传入流量。

The --upgrade option updates an existing service. You can update only the following project definition parameters:

  • min_instances
  • max_instances
  • query_warehouse
  • auto_resume
  • external_access_integrations
  • comment

示例

The following example creates and deploys a service defined in the snowflake.yml file in the current directory.

snow spcs service deploy
+---------------------------------------------------------------------+
| key    | value                                                      |
|--------+------------------------------------------------------------|
| status | Service MY_SERVICE successfully created.                   |
+---------------------------------------------------------------------+