snow connection add

添加与配置文件的连接。

语法

snow connection add
  --connection-name <connection_name>
  --account <account>
  --user <user>
  --password <password>
  --role <role>
  --warehouse <warehouse>
  --database <database>
  --schema <schema>
  --host <host>
  --port <port>
  --region <region>
  --authenticator <authenticator>
  --workload-identity-provider <workload_identity_provider>
  --private-key <private_key_file>
  --token-file-path <token_file_path>
  --default
  --no-interactive
  --secondary-roles <secondary_roles>
  --format <format>
  --verbose
  --debug
  --silent
  --enhanced-exit-codes
  --decimal-precision <decimal_precision>

实参

选项

--connection-name, -n TEXT

新连接的名称。

-a, --account, --accountname TEXT

使用 Snowflake 进行身份验证时使用的账户名。

-u, --user, --username TEXT

连接到 Snowflake 的用户名。

-p, --password TEXT

Snowflake 密码。

-r, --role, --rolename TEXT

在 Snowflake 上使用的角色。

-w, --warehouse TEXT

在 Snowflake 上使用的仓库。

-d, --database, --dbname TEXT

在 Snowflake 上使用的数据库。

-s, --schema, --schemaname TEXT

在 Snowflake 上使用的架构。

-h, --host TEXT

连接尝试连接到 Snowflake 的主机名。

-P, --port INTEGER

主机上要与之通信的端口。

--region, -R TEXT

如果不是默认 Snowflake 部署,则使用区域名称。

-A, --authenticator TEXT

如果不是基于密码,则选择身份验证器。

-W, --workload-identity-provider TEXT

Workload identity provider type.

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

包含私钥的文件路径。

-t, --token-file-path TEXT

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

--default

如果提供,连接将配置为默认连接。默认值:False。

--no-interactive

禁用提示。默认值:False。

--secondary-roles TEXT

Secondary roles mode applied when the session starts. Supported values are ALL and NONE; pass NONE to run the session only with the primary role.

--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 connection add command adds the connection to your default config.toml file. For more information, see Configuring Snowflake CLI and connecting to Snowflake.

示例

要添加连接,请运行以下命令:

snow connection add
Enter connection name: <connection_name>
Enter account: <account>
Enter user: <user-name>
Enter password: <password>
Enter role: <role-name>
Enter warehouse: <warehouse-name>
Enter database: <database-name>
Enter schema: <schema-name>
Enter host: <host-name>
Enter port: <port-number>
Enter region: <region-name>
Enter authenticator: <authentication-method>
Enter private key file: <path-to-private-key-file>
Enter token file path: <path-to-mfa-token>
Do you want to configure key pair authentication? [y/N]: y
Key length [2048]: <key-length>
Output path [~/.ssh]: <path-to-output-file>
Private key passphrase: <key-description>
Wrote new connection <connection-name> to config.toml
Wrote new connection my_conn to <user-home>/.snowflake/config.toml