Snowflake
Overview
When exposing your data to mediarithmics we recommend the following structure :
A Snowflake database that contains :
One or multiple schemas with data you want to expose to mediarithmics with read-only access
2 schemas specifically created for mediarithmics usage with read and write access.
You do not have to expose all tables/views in a given schema. Refer to this section for more information
This page describes how to set up a service account with such access.
Steps
Service account and permissions setup
Create dedicated schemas for mediarithmics usage
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
Grant limited access
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)
2. Create dedicated schemas for mediarithmics usage
We recommend to create two dedicated schemas for mediarithmics usage.
mics_workspace schema that holds all temporary tables created while syncing with your warehouse
mics_output schema that holds all output tables — the clean results of daily processing, ready for consumption
Note that the tables in mics_output are not meant to be interface tables : their schema could change with successive releases. If you need a specific stable table schema to expose it to other tools, please contact your account manager.
The service account you created should have full access (read/write) on both schemas. Use this code to do so :
Nota bene : If you wish to use a synchronization strategy that handles updates and deletes of data, you will need a working schema (i.e. the mics_workspace schema)
3. 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
4. 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 3 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?