Snowflake
Creating a connection to Snowflake requires to set up key-pair authentication
Steps
Generate a private and a public key
Assign the public key to a Snowflake user
Create and format a credentials JSON file
1. Private and public key generation
Use the following command to generate a private key (called rsa_key.p8)
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocryptThen use the following command to generate a public key (called rsa_key.pub linked to the private key called rsa_key.pub stored in the current directory)
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub2. Assigning public key to Snowflake user
From the Snowflake interface or the Snowflake CLI run the following SQL query to assign the public key generated at step 1 (rsa_key.pub) to the snowflake user : 
ALTER USER <user_name> SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';Also make sure the user also has a default warehouse, else run this query :
ALTER USER <user_name> SET DEFAULT_WAREHOUSE=<warehouse_name>3. Edit a credentials file
Now you need to generate a JSON file with the following format :
{
"user" : "user_name",
"account" : "organinization_name-account_name",
"database" : "database",
"private_key" : "-----BEGIN PRIVATE KEY-----\nMII..."
}"user": the user you associated the public key with"account": the "account" property is what is called "Account identifier" in Snowflake. It's usually the organization name and the account name hyphenated"database": the database containing the data you want to make available to mediarithmics"private key": the private key generated in step one and associated to the user public key. Be ware of the formatting of the private key : the key must be in on a single line, this means you should use a "\n" separator at each return to line of the private key.
Last updated
Was this helpful?