snow helpers import-snowsql-connections¶
Import your existing connections from your SnowSQL configuration.
Syntax¶
snow helpers import-snowsql-connections
--snowsql-config-file <custom_snowsql_config_files>
--default-connection-name <default_cli_connection_name>
--format <format>
--verbose
--debug
--silent
Arguments¶
None
Options¶
--snowsql-config-file FILE
Specifies file paths to custom SnowSQL configuration. The option can be used multiple times to specify more than one file.
--default-connection-name TEXT
Specifies the name that is given in Snowflake CLI to the default connection imported from SnowSQL. Default: default.
--format [TABLE|JSON]
Specifies the output format. Default: 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
Turns off intermediate output to console. Default: False.
--help
Displays the help text for this command.
Usage notes¶
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 |
---|---|
|
[connections]
[connections.example]
username=user1
|
|
[connections]
[connections.example]
username=user2
password=<my-pwd>
|
After you run the command, your Snowflake CLI config.toml
file contains the following [connections.example]
definition (from the file with the higher precedence):
[connections]
[connections.example]
username=user2
password=<my-pwd>
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.
Examples¶
The following example imports SnowSQL connections from the standard configuration file locations:
snow helpers import-snowsql-connections
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.
SnowSQL config file [/etc/snowsql.cnf] does not exist. Skipping.
SnowSQL config file [/etc/snowflake/snowsql.cnf] does not exist. Skipping.
SnowSQL config file [/usr/local/etc/snowsql.cnf] does not exist. Skipping.
Trying to read connections from [/Users/<user>/.snowsql.cnf].
Reading SnowSQL's connection configuration [connections.connection1] from [/Users/<user>/.snowsql.cnf]
Trying to read connections from [/Users/<user>/.snowsql/config].
Reading SnowSQL's default connection configuration from [/Users/<user>/.snowsql/config]
Reading SnowSQL's connection configuration [connections.connection1] from [/Users/<user>/.snowsql/config]
Reading SnowSQL's connection configuration [connections.connection2] from [/Users/<user>/.snowsql/config]
Connection 'connection1' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: Y
Connection 'connection2' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: n
Connection 'default' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: n
Saving [connection1] connection in Snowflake CLI's config.
Connections successfully imported from SnowSQL to Snowflake CLI.