Setting Up SnowCLI Connection

1

Configuring SnowCLI Connection

Add a new connection to Snow CLI that will use the key pair authentication.
NOTE: The Snowflake user that will be added to the connection can have MFA and/or SSO enabled as these options do not conflict with key pair authentication.
2

Install SnowCLI

pip install -U snowflake-cli-labs
3

Create The Connection

Add a new connection to SnowCLI by running
snow connection add
Provide a name
GENESIS_SYSTEM_DATA
Enter the account name (format of <region>-<account_name>)
dshrnxx-genesis-consumer
Enter the Snowflake user name
michael.rainey@genesiscomputing.ai
Role for the connection
accountadmin (or other role that has the application role GENESIS_BOTS.APP_PUBLIC granted to it)
All other settings are blank until…
Authentication method
SNOWFLAKE_JWT
Path to private key file
/Users/mrainey/Documents/keys/rsa_key.p8

Output Example

The output will look like the following
snow connection add                                    
Name for this connection: GENESIS_SYSTEM_DATA
Snowflake account name: dshrnxx-genesis-consumer
Snowflake username: michael.rainey@genesiscomputing.ai
Snowflake password [optional]: 
Role for the connection [optional]: accountadmin
Warehouse for the connection [optional]: 
Database for the connection [optional]: 
Schema for the connection [optional]: 
Connection host [optional]: 
Connection port [optional]: 
Snowflake region [optional]: 
Authentication method [optional]: 
Path to private key file [optional]: /Users/mrainey/Documents/keys/rsa_key.p8

Wrote new connection provider-genesis-aws-west to /Users/mrainey/Library/Application Support/snowflake/config.toml
NOTE: Check your config.toml file, it should look like this
[connections.GENESIS_SYSTEM_DATA]
account = "dshrnxx-genesis-consumer"
user = "michael.rainey@genesiscomputing.ai"
authenticator = "SNOWFLAKE_JWT"
role = "accountadmin"
private_key_path = "/Users/mrainey/Documents/keys/rsa_key.p8"
You can also add the connection directly to the config.toml file.

Test Your Connection

In a command line prompt, run the following to test that your connection is set up correctly. (Change your connection name as per what you used above)
snow sql -c GENESIS_SYSTEM_DATA -q "SELECT 'Hello world?' Msg"