Snowflake Destination

Sync data from RudderStack to Snowflake.

Snowflake is a popular cloud-based data warehouse known for its speed, scalability, and reliability.

See the Warehouse Schema guide for how events are mapped to Snowflake tables.

Find the open source code for this destination in the GitHub repository.

Set user permissions in Snowflake

Log in with the ACCOUNTADMIN role, or ask your Snowflake admin to grant your account the MANAGE GRANTS privilege. Then, follow the below sections to create a warehouse, database, role, and user in Snowflake.

Optional: Create a warehouse

info
Skip this step to use an existing warehouse.

In your Snowflake console, create a warehouse depending on your data volume requirements.

Create a virtual warehouse

Alternatively, run the following SQL commands to create a new warehouse:

CREATE WAREHOUSE "<WAREHOUSE_NAME>"
  WITH WAREHOUSE_SIZE = 'XSMALL'
    WAREHOUSE_TYPE = 'STANDARD'
    AUTO_SUSPEND = 600
    AUTO_RESUME = TRUE;
tip
Tip: Set AUTO_SUSPEND to ~10 minutes and enable AUTO_RESUME to avoid extra costs.

Create a database

Create a new database to avoid conflicts with your existing data. New tables are created automatically while storing your events.

Create a database

Alternatively, run the following command:

CREATE DATABASE "<DATABASE_NAME>";

Create a role for RudderStack

Run the following SQL commands to create a new role with the required permissions to load your data into the database:

  1. Create a new role called <ROLE>:
CREATE ROLE "<ROLE>";
  1. Grant access to the warehouse <WAREHOUSE_NAME>:
GRANT USAGE ON WAREHOUSE "<WAREHOUSE_NAME>" TO ROLE "<ROLE>";
  1. Grant access to the database <DATABASE_NAME>:
GRANT USAGE ON DATABASE "<DATABASE_NAME>" TO ROLE "<ROLE>";
GRANT CREATE SCHEMA ON DATABASE "<DATABASE_NAME>" TO ROLE "<ROLE>";
GRANT ALL ON ALL SCHEMAS IN DATABASE "<DATABASE_NAME>" TO ROLE "<ROLE>";
info
You can also create a custom role with the necessary permissions and specify it in the dashboard settings while setting up the Snowflake destination.

Create a user

Create a user to connect RudderStack to your warehouse:

CREATE USER "<USER_NAME>"
  MUST_CHANGE_PASSWORD = FALSE
  DEFAULT_ROLE = "<ROLE>"
  PASSWORD = "<STRONG_PASSWORD>";
GRANT ROLE "<ROLE>" TO USER "<USER_NAME>";

Set up the Snowflake destination in RudderStack

  1. In your RudderStack dashboard, add a source. Then select Snowflake from the list of destinations.
  2. Assign a name to your destination and click Continue.

Connection settings

SettingDescription
AccountEnter the account ID of your Snowflake warehouse. This ID is part of the Snowflake URL. See the Snowflake account ID examples below for more information.
DatabaseEnter the name of the database created in the Create a database section.
WarehouseEnter the name of the warehouse created in the Create a warehouse section.
UserEnter the name of the user created in the Create a user section.
RoleSpecify the role to assign to the above user. If not specified, the default role is used. Make sure your role has the necessary permissions to load data into the warehouse.
Use Key Pair AuthenticationTurn on this toggle to authenticate the user via a key pair. See the key pair authentication section below for details.
PasswordVisible only if Use Key Pair Authentication is toggled off. Enter the password for the user specified above.
NamespaceEnter the schema name where all tables are created. If not specified, the namespace defaults to the source name. You cannot change the namespace later.
Sync FrequencySpecify how often data syncs to your Snowflake warehouse.
Sync Starting At(Optional) Specify the time of day (in UTC) to start the sync.
Exclude Window(Optional) Set a time window during which data will not sync to the warehouse.

Snowflake account ID examples

Account ID exampleSnowflake URLCloud provider
qya56091.us-east-1https://qya56091.us-east-1.snowflakecomputing.comAWS
qya56091.us-east-2.awshttps://qya56091.us-east-2.aws.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
warning
For AWS, .aws is present in the account locator for some regions and must be included in the Account setting. See the Snowflake documentation for account locator formats by region and cloud provider.

Key pair authentication

info

For enhanced security, use key pair authentication over basic authentication (username and password).

SettingDescription
Private KeyEnter your private key, including the delimiters.
Private Key PassphraseEnter the passphrase you set while encrypting the private key. Leave blank if your private key is not encrypted.
danger
Authentication fails if your private key is encrypted and you don’t specify the passphrase.

Configure object storage

You can configure the following object storage settings:

  • Use RudderStack-managed Object Storage: Enable this setting to use RudderStack-managed buckets for object storage.
warning
This option is applicable only for RudderStack-hosted data planes. For self-hosted data planes, specify your own object storage configuration.
  • Choose your Cloud: Select the cloud provider for your Snowflake instance:

See How RudderStack stores data in an object storage platform for more information.

  • Clean up object storage files after successful sync: Turn on this toggle to delete the object storage files after the sync completes successfully.

Advanced settings

RudderStack provides the following advanced settings:

  • Warehouse Append: This setting is turned on by default - RudderStack appends your incoming Event Stream data to the existing data in your warehouse. Turning it off causes RudderStack to merge your incoming data into your warehouse to ensure 100% non-duplicate data.
info

The append operation helps to achieve faster data syncs while reducing warehouse costs. However, note that it may increase the number of duplicates in the warehouse, especially if the existing data is older than 7 days. A common scenario where duplication might occur is when the SDKs retry sending events in case of failures.

A merge strategy ensures deduplication but can lead to longer sync times and increased warehouse costs.

  • Skip Users Table: This setting is toggled on by default and sends events exclusively to the identifies table while skipping the users table. This eliminates the need for a merge operation on the users table. If toggled off, RudderStack sends the events to both the identifies and users tables.
  • Skip Tracks Table: Toggle on this setting to skip sending events to the tracks table.
  • JSON Columns: Lets you ingest semi-structured event data not defined by a fixed schema. You can specify the required JSON column paths in this setting in dot notation, separated by commas. This option applies to all incoming track events for this destination. See JSON Column Support for more information.

Configure cloud storage integration with Snowflake

Use the storage integration to run the COPY command. Configure the Storage Integration setting specified in the Configure object storage section above.

IPs to allowlist

To enable network access to RudderStack, allowlist the following RudderStack IPs depending on your region and RudderStack plan:

Plan
Region
US
EU
Free, Starter, and Growth
  • 3.216.35.97
  • 18.214.35.254
  • 23.20.96.9
  • 34.198.90.241
  • 34.211.241.254
  • 52.38.160.231
  • 54.147.40.62
  • 3.123.104.182
  • 3.125.132.33
  • 18.198.90.215
  • 18.196.167.201
Enterprise
  • 3.216.35.97
  • 34.198.90.241
  • 44.236.60.231
  • 54.147.40.62
  • 100.20.239.77
  • 3.66.99.198
  • 3.64.201.167
  • 3.123.104.182
  • 3.125.132.33
info
All the outbound traffic is routed through these RudderStack IPs.

Troubleshooting

IssueSolution
Connection verification step failsVerify the following:

  • The entire contents of the private key are specified in the Private Key field, including the BEGIN RSA PRIVATE KEY and END RSA PRIVATE KEY delimiters.
  • In case of an encrypted private key, you have specified the passphrase in the Passphrase field.
HTTP 404 error during connection verificationVerify your Snowflake account URL is correct. You can use the following command to check if the account URL is correct:

CURL -I https://<account_id>.snowflakecomputing.com

Questions? We're here to help.

Join the RudderStack Slack community or email us for support