Snowflake
Creating a connection to Snowflake requires to set up key-pair authentication.
Steps
Service account and permissions setup
Configure key-pair authentication
Create and format a credentials JSON file
For more information on Snowflake key-pair authentication please refer to Snowflake documentation https://docs.snowflake.com/en/user-guide/key-pair-auth
1. Service account and permissions setup
For the initial set up, start with the SQL script template below. The script will :
Create a dedicated service account, role, and warehouse for mediarithmics to use
Give the service account read only access on a database of your choice and all its content
Create a working schema inside the database and give full access (read/write) to the service account on the schema
You can edit this template to match your needs for instance :
If you want to set up access to multiple databases
If you wish to restrict access to specific tables or views the minimum permissions required are :
USAGE on DATABASEUSAGE on SCHEMASELECT on TABLES(or VIEWS)
If you don't need the working schema you can omit the last part of the script
2. Configure key-pair authentication
Use the following command to generate a private key (called rsa_key.p8)
Then 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)
Then, 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 service account created for mediarithmics to use :
Nota bene :
Exclude the public key delimiters in the SQL statement
To run this query you will need one of the following role/privilege
The MODIFY PROGRAMMATIC AUTHENTICATION METHODS or OWNERSHIP privilege on the user
The SECURITYADMIN role or higher
3. Edit a credentials file
Now you need to generate a JSON file with the following format :
"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?