Snowflake reverse ETL source

Send data from Snowflake to your entire stack.

Snowflake is a cloud-based data warehouse provided as Software-as-a-Service (SaaS). It offers all features of a modern data warehouse, including scalability, ease of use, secure data access, and much more.

RudderStack supports Snowflake as a source from which you can ingest data and route it to your desired downstream destinations.

Granting permissions

RudderStack requires you to grant certain user permissions on your Snowflake warehouse to successfully access data from it.

Run the queries listed in the following sections in the exact order to grant these permissions:

warning
You must have the ACCOUNTADMIN role in order to grant these permissions.
Snowflake account admin role

Step 1: Creating a new role and user in Snowflake

  1. In your Snowflake console, run the following command to create a role RUDDER_ROLE in Snowflake. After creating the role, you can grant object privileges to it.
CREATE ROLE RUDDER_ROLE;
  1. Verify if the role RUDDER_ROLE is successfully created.
SHOW ROLES;
  1. Create a new user RUDDER with a password <strong_unique_password>.
CREATE USER RUDDER PASSWORD = '<strong_unique_password>' DEFAULT_ROLE = 'RUDDER_ROLE';
info
You can assign some other role to this user in the RudderStack dashboard settings later, as specified in the Configuring the connection credentials section.
  1. Verify if the user RUDDER is successfully created.
SHOW USERS;

Step 2: Creating the RudderStack schema and granting permissions to the role

  1. Create a dedicated schema _RUDDERSTACK in your database <YOUR_DATABASE>.
CREATE SCHEMA "<YOUR_DATABASE>"."_RUDDERSTACK";
warning
The _RUDDERSTACK schema is used by RudderStack for storing the state of each data sync. This name should not be changed.
  1. Grant full access to the schema _RUDDERSTACK for the previously created role RUDDER_ROLE .
GRANT ALL PRIVILEGES ON SCHEMA "<YOUR_DATABASE>"."_RUDDERSTACK" TO ROLE RUDDER_ROLE;

Replace <YOUR_DATABASE> with the exact name of your Snowflake database.

Step 3: Granting permissions on the warehouse, database, schema, and the table

  1. Enable the user RUDDER to perform all operations allowed for the role RUDDER_ROLE(via the privileges granted to it).
GRANT ROLE RUDDER_ROLE TO USER RUDDER;
  1. Run the following commands to allow the role RUDDER_ROLE to look up the objects within your warehouse, database, schema, and the specific table or view:
GRANT USAGE ON WAREHOUSE "<YOUR_WAREHOUSE>" TO ROLE RUDDER_ROLE;
GRANT USAGE ON DATABASE "<YOUR_DATABASE>" TO ROLE RUDDER_ROLE;
GRANT USAGE ON SCHEMA "<YOUR_DATABASE>"."<YOUR_SCHEMA>" TO ROLE RUDDER_ROLE;
GRANT SELECT ON TABLE "<YOUR_DATABASE>"."<YOUR_SCHEMA>"."<YOUR_TABLE>" TO ROLE  RUDDER_ROLE;
GRANT SELECT ON VIEW "<YOUR_DATABASE>"."<YOUR_SCHEMA>"."<YOUR_VIEW>" TO ROLE  RUDDER_ROLE;

Replace <YOUR_WAREHOUSE>, <YOUR_DATABASE>, <YOUR_SCHEMA>, <YOUR_TABLE>, and <YOUR_VIEW> with the exact names of your Snowflake warehouse, database, schema, table, and view respectively.

Optional commands

warning
Run the following commands only if you’re okay with RudderStack being able to access all current or future tables/views within your specified schema.
  • To allow the role RUDDER_ROLE to read data from all the tables in the schema <YOUR_SCHEMA>.
GRANT SELECT ON ALL TABLES IN SCHEMA "<YOUR_DATABASE>"."<YOUR_SCHEMA>" TO ROLE RUDDER_ROLE;
  • To allow the role <RUDDER_ROLE> to read data from all future tables in the schema <YOUR_SCHEMA>.
GRANT SELECT ON FUTURE TABLES IN SCHEMA "<YOUR_DATABASE>"."<YOUR_SCHEMA>" TO ROLE RUDDER_ROLE;
  • To allow the role RUDDER_ROLE to read data from all the views in the schema <YOUR_SCHEMA>.
GRANT SELECT ON ALL VIEWS IN SCHEMA "<YOUR_DATABASE>"."<YOUR_SCHEMA>" TO ROLE RUDDER_ROLE;
  • To allow the role <RUDDER_ROLE> to read data from all future views in the schema <YOUR_SCHEMA>.
GRANT SELECT ON FUTURE VIEWS IN SCHEMA "<YOUR_DATABASE>"."<YOUR_SCHEMA>" TO ROLE RUDDER_ROLE;

Replace <YOUR_DATABASE> and <YOUR_SCHEMA> with the exact Snowflake database and the schema names.

Setting up the Snowflake source in RudderStack

To set up Snowflake as a source in RudderStack, follow these steps:

Naming the source

  1. Log into your RudderStack dashboard.
  2. From the left navigation bar, go to Source > New Source > Reverse ETL. Then, select Snowflake:
Select Reverse ETL source in RudderStack
  1. Assign a name to your source.

Configuring the connection credentials

  1. Choose the relevant option from Table or Model to use the source to sync data from either a warehouse table or a model.
info
For more information on the difference between the Table and Model options when creating a Reverse ETL source, refer to the FAQ section below.
info
If you have chosen the Model option, skip the next steps and refer to the Schedule settings section directly.
  1. Enter the relevant settings in the Connection Credentials section as listed below:

    • Account - This is your warehouse account ID. The account ID is part of the Snowflake URL. The following examples illustrate the slight differences in the account ID for various cloud providers:
    Account ID sampleSnowflake URLSnowflake cloud provider
    qya56091.us-east-1https://qya56091.us-east-1.snowflakecomputing.comAWS
    rx18795.east-us-2.azurehttps://rx18795.east-us-2.azure.snowflakecomputing.comMicrosoft Azure
    ah76025.us-central1.gcphttps://ah76025.us-central1.gcp.snowflakecomputing.comGoogle Cloud Platform
    • Database: Enter the name of the database in which your data resides.
    • Warehouse: Specify the name of your data warehouse.
    • User: Enter the name of the user that has the required read/write access to the above database.
    • Role: Enter a role you want to assign to the above user. For syncing the data, you can use this role apart from the default role (RUDDER_ROLE) assigned in the Creating a new role and user section.
    • Password: Enter the password for the above user.
    • Choose your Cloud: Specify your cloud provider in this field.
info
If you’ve configured Snowflake as a source before, you can select the existing credentials under the Use existing credentials option.
  1. Click Continue. RudderStack will then verify and validate your credentials.
info
For more information on these validation steps, refer to the FAQ section.
  1. Once verified, click Continue to proceed.

Schedule settings

  1. Specify the Schedule Settings to schedule the data syncs from your Snowflake instance.
info
RudderStack lets you schedule data syncs for your Reverse ETL sources and specify how and when the syncs will run. For more information on the Basic, CRON, and Manual schedule types, refer to the Sync Schedule Settings guide.
  1. After specifying the schedule type and run settings, click Continue to finish the setup.

Snowflake is now successfully configured as a source in your RudderStack dashboard. You can further connect this source to your preferred destination by clicking on Add Destination button:

Add destination in RudderStack
info
If you have already configured a destination in RudderStack, choose the Use Existing Destinations option which will take you to the Schema tab in the source settings. To add a new destination from scratch, select the Create New Destination option which will take you to the destination configuration page.

Specifying the data to import

While connecting a destination to your Reverse ETL source, you can use the default JSON mapping or the Visual Data Mapping feature.

info

Based on the option(Table/Model) you chose while setting up the Reverse ETL source, follow the relevant guide for detailed steps:

FAQ

What do the three validations under Verifying Credentials imply?

When setting up a Reverse ETL source, once you proceed after entering the connection credentials, you will see the following three validations under the Verifying Credentials option:

Validations

These options are explained below:

  • Verifying Connection: This option indicates that RudderStack is trying to connect to the warehouse with the information specified in the connection credentials.
warning
If this option gives an error, it means that one or more fields specified in the connection credentials are incorrect. Verify your credentials in this case.
  • Able to List Schema: This option checks if RudderStack is able to fetch all schema details using the provided credentials.
  • Able to Access RudderStack Schema: This option implies that RudderStack is able to access the _rudderstack schema you have created by successfully running all commands in the User Permissions section.
warning
If this option gives an error, verify if you have successfully created the _rudderstack schema and given RudderStack the required permissions to access it. For more information, refer to the User Permissions sections.

Questions? Contact us by email or on Slack