Managing connections

This topic covers the following subjects:

How to test a connection

You can test your connection configuration by running the snow connection test, similar to the following:

snow connection test --connection="myconnection"
Copy

How to use a temporary connection

You can also specify connection parameters from command line using the --temporary-connection [-x] option. It ignores all definitions from the config.toml, using ones specified by command line options instead. This approach can be helpful for CI/CD use cases when you don’t want to have config file.

snow sql -q "select 42;" --temporary-connection \
                           --account myaccount \
                           --user jdoe
Copy
select 42;
+----+
| 42 |
|----|
| 42 |
+----+

You can use the following command options to override connection attributes:

  • --account, --accountname TEXT: Name assigned to your Snowflake account.

  • --user,--username TEXT: Username to connect to Snowflake.

  • --password TEXT: Snowflake password.

    Caution

    For improved security, Snowflake strongly recommends using the $SNOWFLAKE_PASSWORD environment variable so the password is not included in the logs.

  • --authenticator TEXT: Snowflake authenticator.

  • --private-key-path TEXT: Snowflake private key path.

  • --database,--dbname TEXT: Database to use.

  • --schema,--schemaname TEXT: Database schema to use.

  • --role,--rolename TEXT: Role to use.

  • --warehouse TEXT: Warehouse to use.

  • --temporary-connection [-x]: Use the connection defined with command line parameters instead of one defined in config.toml.

How to use a different configuration file

In some situations, such as a continuous integration, continuous deployment (CI/CD) environment, you might prefer to create dedicated configuration files for testing and deployment pipelines instead of defining all of the possible configurations in a Snowflake default configuration file.

If you want to use a different configuration file instead of your default file, you can use the --config-file option for the snow command, such as:

snow --config-file="my_config.toml" connection test
Copy