Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

Snowflake Destination


Snowflake(link takes you to an external page) is a data warehouse, built for the cloud, that delivers performance, simplicity, concurrency and affordability.

(information)

Info

Segment has a Terraform provider, powered by the Public API, that you can use to create a Snowflake warehouse. See the segment_warehouse (Resource)(link takes you to an external page) documentation for more information.


Getting started

getting-started page anchor

There are six steps to get started using Snowflake with Segment.

  1. Create a virtual warehouse
  2. Create a database
  3. Create a role for Segment
  4. Create a user for Segment
  5. Test the user and credentials
  6. Connect Snowflake to Segment
(information)

View observability metrics with Delivery Overview

Delivery Overview, Segment's built-in observability tool, is now in public beta for storage destinations. For more information, see the Delivery Overview documentation.

Prerequisites

prerequisites page anchor

To set up the virtual warehouse, database, role, and user in Snowflake for Segment's Snowflake destination, you must have the ACCOUNTADMIN role, or, a custom role with the following Snowflake privileges(link takes you to an external page):

To set up the Snowflake storage destination in Segment, you must have either a role in the Segment app of Workspace Owner or, for Business Tier users, Warehouse Destination Admin.

Step 1: Create a virtual warehouse

step-1-create-a-virtual-warehouse page anchor

Segment's Snowflake destination requires you to first create a Snowflake virtual warehouse(link takes you to an external page).

To avoid conflicts with other operations in your cluster, Segment recommends that you create a new warehouse just for Segment loads. An X-Small warehouse is large enough for most Segment customers when they first create their Snowflake destination.

To create a new virtual warehouse, navigate to Warehouses > Create in Snowflake's Classic Console or execute the following SQL command:

1
CREATE WAREHOUSE "SEGMENT_WAREHOUSE"
2
WITH WAREHOUSE_SIZE = 'XSMALL'
3
WAREHOUSE_TYPE = 'STANDARD'
4
AUTO_SUSPEND = 600
5
AUTO_RESUME = TRUE;
(success)

Success!

Set AUTO_SUSPEND to ~10 minutes in the UI (or 600 if using SQL) and enable AUTO_RESUME to avoid extra costs, as Snowflake uses per-second billing(link takes you to an external page).

Step 2: Create a database

step-2-create-a-database page anchor

Segment recommends creating a new database just for Segment information, as the Segment Snowflake destination creates its own schemas and tables and could create name conflicts with your existing data.

To create a new database, execute the following SQL command:

CREATE DATABASE "SEGMENT_EVENTS";

Step 3: Create a role for Segment

step-3-create-a-role-for-segment page anchor

You need to run these SQL commands rather than creating a role with the "Create Role" dialog in the Classic Console UI.

This role gives Segment just enough permission to load data into your database. Segment recommends that you don't reuse this role for other operations.

  1. Click on Worksheets
  2. Select SEGMENT_EVENTS under database objects
  3. Change the role to ACCOUNTADMIN
  4. Create a new role by executing the following command:
CREATE ROLE "SEGMENT";
  1. Grant access to the virtual warehouse by executing the following SQL command:
GRANT USAGE ON WAREHOUSE "SEGMENT_WAREHOUSE" TO ROLE "SEGMENT";
  1. Grant access to the database by executing the following SQL command:
1
GRANT USAGE ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";
2
GRANT CREATE SCHEMA ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";

Step 4: Create a user for Segment

step-4-create-a-user-for-segment page anchor

Create the user that Segment uses to connect to your warehouse. You can create a user that authenticates with a key pair.

(information)

Info

Snowflake plans to deprecate password-only authentication starting August 2026. Learn more in the Snowflake docs(link takes you to an external page).

To create a user that authenticates with a key pair:

  1. Create the user and assign it a key pair by following the instructions in the Snowflake docs(link takes you to an external page).
  2. Create a new user by executing the following SQL command, replacing the public key value with the key you previously generated.
1
CREATE USER SEGMENT_USER
2
DEFAULT_ROLE = SEGMENT
3
RSA_PUBLIC_KEY = 'enter your public key';
4
GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";

Step 5: Test the user and credentials

step-5-test-the-user-and-credentials page anchor

Before you continue, test and validate the new user and credentials. After you verify the new credentials, you can connect Snowflake to Segment.

Test a key pair

test-a-key-pair page anchor

Segment uses SnowSQL(link takes you to an external page) to run these verification steps. To install SnowSQL and verify your accounts:

  1. Download SnowSQL(link takes you to an external page)
  2. Open the Installer and follow instructions.
  3. When the installation is complete, run the following command, replacing "account", "username", and "path_to_the_rsa_key_encrypted.p8" with your Snowflake Account ID, username, and path to your private RSA key:
snowsql -a segment -u <username> -d <Database> -w <warehouse> --private-key-path <path_to_the_rsa_key_encrypted.p8>

For accounts outside the US, the account ID includes the region. You can find your account name from the browser address string.

For example, if your web address is https://myaccountname.snowflakecomputing.com/console#/internal/worksheet, your account name would be myaccountname.

Step 6: Connect Snowflake to Segment

step-6-connect-snowflake-to-segment page anchor
(information)

Unified warehouse credentials in public beta

With unified warehouse credientials you can create warehouse credentials and use them across Segment warehouse products. Segment is actively working on this feature. Some functionality may change before it becomes generally available.

To connect Snowflake to Segment:

  1. Navigate to your product area:
    • For Storage destinations, navigate to Connections > Destinations and select the Storage tab. Click + Add storage destination.
    • For Profiles Sync, navigate to Unify > Profiles Sync.
  2. Select Snowflake as your warehouse.
  3. Select an existing warehouse credential or create a new warehouse credential by completing the following fields for your Snowflake instance.
    • Account ID: The Snowflake account ID that uniquely identifies your organization account, including a region suffix if applicable.
    • Database name: The database that Segment uses in order to sync data
    • Warehouse: The warehouse in your Snowflake account that Segment uses to run SQL
    • Username: The Snowflake user that Segment uses to run in your warehouse
    • Authentication: Snowflake only supports authentication using a key pair.
      • Private key: View Snowflake's key pair set up doc(link takes you to an external page). You can upload in .p8 file format. Key length must be at least 2048-bit. An encrypted key is recommended but not required. You need to first create the user and assign it a key pair following the instructions in the Snowflake docs. Then, set the segment_connections_username variable in the SQL script to the user you just created.
  4. Test your connection.
  5. Click Save.
(information)

Segment supports uploading one key at a time

Although you can create up to two keys in Snowflake, Segment only supports authenticating with one key at a time. To change the key that is in Segment, return to your Snowflake destination's settings and upload a new key in the Private Key field.


After you connect Snowflake, you can add a Snowflake Activation from Engage. Linked Audiences writes audience enter/exit events to your warehouse, and Event-Triggered Journeys writes journey step events.

Segment recommends key-pair authentication for the Snowflake user. For more information, see create a user that authenticates with a key pair.

Schema and table selection (beta)

schema-and-table-selection-beta page anchor

When you create a Snowflake Activation from Engage, choose the schema and either select an existing table or enter a new table name. Engage writes to exactly what you specify.

Sync behavior for Engage (beta)

sync-behavior-for-engage-beta page anchor

For Engage writebacks, Segment starts a warehouse sync after each run completes (for example, when an audience run finishes). This replaces a fixed hourly cadence for these writebacks.

(warning)

Warning

Changing the Snowflake destination's general sync schedule does not affect Engage writebacks. Engage controls when these writes occur.

Engage writebacks use Track events. The full event payload is stored in a single stringified JSON column in the target table.


If you create a network policy with Snowflake and are located in the US, add 52.25.130.38/32 and 34.223.203.0/28 to the "Allowed IP Addresses" list.

If you create a network policy with Snowflake and are located in the EU, add 3.251.148.96/29 to your "Allowed IP Addresses" list.

Multi-Factor Authentication (MFA) & SSO

multi-factor-authentication-mfa--sso page anchor

At this time, the Segment Snowflake destination is not compatible with Snowflake's MFA or SSO settings. If your connected user has MFA or SSO enabled, you will need to disable it for syncs to run correctly.


Segment recommends that you authenticate with your Snowflake warehouse using an encrypted key pair. Key-pair authentication uses PKCS#8 private keys, which are typically exchanged in the PEM base64-encoded format.

Although you can create up to two keys in Snowflake, Segment only supports authenticating with one key at a time. To change the key that's used to authenticate with Segment, return to your Snowflake destination's settings and upload a new key in the Private Key field.

Auto Suspend and Auto Resume

auto-suspend-and-auto-resume page anchor

Set AUTO_SUSPEND to ~10 minutes in the UI (or 600 if using SQL) to minimize the credit consumption of Segment's syncing process.

If you enable the AUTO_SUSPEND feature, Segment recommends that you also enable AUTO-RESUME. This will ensure that your Snowflake warehouse automatically resumes when Segment loads data. Otherwise, Segment will not be able to load data unless you manually resume your Snowflake warehouse(link takes you to an external page).

Unique Warehouse, Database, and Role

unique-warehouse-database-and-role page anchor

Segment recommends creating a unique Warehouse, Database, and Role for the Segment Snowflake connection to your Snowflake instance to avoid conflicts with other operations happening in your cluster.


I get "Object does not exist" when running "USE DATABASE" or "USE WAREHOUSE", even if the warehouse or the database are created.

i-get-object-does-not-exist-when-running-use-database-or-use-warehouse-even-if-the-warehouse-or-the-database-are-created page anchor

Make sure you created the role and assigned the proper permissions with the account SYSADMIN or ACCOUNTADMIN. Other non-system accounts don't assign the right permissions.

I've consumed all my credits after the initial sync.

ive-consumed-all-my-credits-after-the-initial-sync page anchor

If you have used all your credits, you must contact Snowflake to purchase more.

Also, make sure AUTO_SUSPEND is enabled and set to 5 or 10 minutes in the warehouse used by Segment. This setting helps avoid unintended use of credits by the Segment Snowflake destination.

My syncs are going slower than I expect.

my-syncs-are-going-slower-than-i-expect page anchor

This complaint is most often due to not using a separate Warehouse specifically for Segment.

If you're already doing so, see this section of the Snowflake docs(link takes you to an external page) for more details on how to handle slow running processes.


What size should I start with when creating a new Snowflake instance?

what-size-should-i-start-with-when-creating-a-new-snowflake-instance page anchor

Most customers have the best luck starting with a X-Small instance.

Why do I see so many 'Rollback' statements?

why-do-i-see-so-many-rollback-statements page anchor

A rollback is issued at the end of each session to make sure there's no "in-flight" processes hanging out that could block other processes later.

Does Segment use transactions for loading data?

does-segment-use-transactions-for-loading-data page anchor

Segment doesn't open transactions explicitly because that would lock resources. However, if autocommit is enabled, each statement functions as its own transaction, and a silent commit is issued after each.

What privileges do I need to grant?

what-privileges-do-i-need-to-grant page anchor

You shouldn't need to grant any additional privileges. However, you may need to confirm that the USAGE privilege on those schemas is granted to the same role granted to the user connecting to Snowflake through Databricks.

Run these statements in Snowflake UI or CLI, and check the output to verify the permissions.

  1. SHOW GRANTS ON SCHEMA <schema_name>; Look in the output to see if USAGE privilege is granted to the role you're using.
  2. SHOW GRANTS TO USER <username>; Replace "username" with the login ID, and verify the correct role is assigned to that login.

Also, if the user has more than one role, make sure the role you use when doing the data pull has USAGE for the schema - and not just the default role. If your organization uses role inheritance (for example, role apples is granted to role gravensteins), then make sure that the role is being assigned and inherited correctly.

Queuing - you can use a different Warehouse for Segment, or use the recommendations from the Snowflake docs.

Can I customize my sync schedule?

can-i-customize-my-sync-schedule page anchor

Your data will be available in Warehouses between 24 and 48 hours from your first sync. Your warehouse then syncs once or twice a day depending on your Segment Plan(link takes you to an external page).

Segment allows Business Tier (BT) customers to schedule the time and frequency of warehouse data syncs.

If you are on a BT plan, you can schedule warehouse syncs by going to Warehouse > Settings > Sync Schedule in the Segment web app. You can schedule up to the number of syncs allowed on your billing plan.

(information)

Info

Engage writebacks (Journeys and Linked Audiences) start a sync when an Engage run completes. The schedule controls, shown in the screenshot, apply to Connections, Profiles Sync and other warehouse deliveries, not to Engage-triggered writebacks.

sync schedule image.

I'm encountering a "JWT token is invalid" error. What do I do?

im-encountering-a-jwt-token-is-invalid-error-what-do-i-do page anchor

For more information about troubleshooting a JWT token is invalid error, see Snowflake's Key Pair Authentication: Troubleshooting(link takes you to an external page) documentation.