snow helpers import-snowsql-connections¶
从 SnowSQL 配置导入现有连接。
语法
实参
无
选项
--snowsql-config-file FILE指定自定义 SnowSQL 配置的文件路径。该选项可以多次用于指定多个文件。
--default-connection-name TEXT指定 Snowflake CLI 中为从 SnowSQL 导入的默认连接提供的名称。默认值:default。
--format [TABLE%JSON%JSON_EXT|CSV]指定输出格式。默认:TABLE。
--verbose, -vDisplays log entries for log levels info and higher. Default: False.
--debugDisplays log entries for log levels debug and higher; debug logs contain additional information. Default: False.
--silent关闭到控制台的中间输出。默认值:False。
--enhanced-exit-codes根据错误类型区分退出错误代码。默认值:False。
--decimal-precision INTEGERNumber of decimal places to display for decimal values. Uses Python’s default precision if not specified. [env var: SNOWFLAKE_DECIMAL_PRECISION].
--helpDisplays the help text for this command.
使用说明
The snow helpers import-snowsql-connections command imports existing connection definitions from SnowSQL into your config.toml configuration file.
By default, the command reads the SnowSQL configuration files in the order described in the Configuring SnowSQL topic.
If more than one of these configurations define the same connection, this command overwrites the previously imported connection definition with the most recent one.
To illustrate, assume the same [connections.example] connection is defined with different parameters in the following locations:
| Location of the configuration file | Connection definition |
|---|---|
/etc/snowsql.cnf | |
<HOME_DIR>/.snowsql/config |
After you run the command, your Snowflake CLI config.toml file contains the following [connections.example] definition (from the file with the higher precedence):
You can use the --snowsql-config-file option to override this default behavior and import from one or more specific SnowSQL configuration files instead.
The snow helpers import-snowsql-connections command also imports the default connection from SnowSQL, which is not a named connection.
It is defined directly in the [connections] section of the configuration file.
Because Snowflake CLI requires all connections to be named, the command defines a connection named [default].
If you want to use another name for the default connection, you can specify it with the --default-connection-name option.
If a SnowSQL connection matches the name of an existing Snowflake CLI connection, the command prompt asks whether you want to overwrite the existing connection or skip importing that SnowSQL connection.
示例
以下示例从标准配置文件位置导入 SnowSQL 连接:
As the command processes the SnowSQL configuration files, it shows the progress and prompts for confirmation when a connection with the same name is already defined in the Snowflake CLI config.toml file.