Snowflake reverse ETL

The Snowflake reverse ETL integration helps you bring data from your Snowflake warehouse into Customer.io. You write a query, and Customer.io runs it on the schedule you set, as often as every minute. Each row your query returns becomes an API call, like identify or track. See About reverse ETL for how syncs work.

Best Practices

Before you add a Reverse ETL source, you should take some measures to ensure the security of your customers’ data and limit performance impacts to your database and Customer.io workspace.

  • Create a new database user/service account. Implement a database user with minimal privileges specifically for Customer.io import/sync operations. This account only requires read permissions with access limited to the tables you want to sync from.

  • Avoid using your main database instance. Consider creating a read-only database instance with replication in place, lightening the load and preventing data loss on your main instance.

  • Sync only the data that you’ll use in Customer.io. Limiting your query can improve performance, and minimizes the potential to expose sensitive data. Select only the columns you care about, and make sure you use the {{last_sync_time}} to limit your query to data that changed since the previous sync.

  • Limit your sync frequency so you don’t sync more than necessary and consume unnecessary resources. If the previous reverse ETL operation is still in progress when the next interval occurs, we’ll skip the operation and catch up your data on the next interval. You should monitor your first few reverse ETL intervals to ensure that your sync doesn’t impact your system’s security and performance—frequently skipped operations may indicate that you’re syncing too often.

Sending excessive data can impact your account's performance

You should not run queries that return large data sets—millions of rows—more than once per day. Doing so may impact workspace performance, including delaying automations and messages.

Granting us access to your database

As a part of setup, you'll need to provide a private key in PKCS#8 PEM format to authenticate with Snowflake.

If you use a firewall or an allowlist, you must allow the following IP addresses so we can connect to your database. Make sure you use the correct IP addresses for your account region.

US RegionEU Region
34.29.50.434.22.168.136
35.222.130.20934.78.194.61
34.122.196.49104.155.37.221
34.9.152.5334.78.153.242
34.170.216.13134.78.94.137
35.222.84.13134.140.151.135
34.57.129.12734.62.147.132

Set up a Snowflake connector

When you set up a Snowflake integration, you’ll need to set up a Snowflake connector that Customer.io will use to connect to Snowflake. We recommend that you use the ACCOUNTADMIN role to execute all the commands below.

Customer.io authenticates with Snowflake using a key pair, not a password. You’ll generate a private key that you give to Customer.io and a public key that you register on the Snowflake user. Snowflake uses the public key to verify that sign-ins from Customer.io are genuine.

  1. Log in to your Snowflake account and go to Worksheets.

  2. Run this code to create a virtual warehouse. We need to execute queries on your Snowflake account, which requires a Virtual Warehouse to handle the compute. You can also reuse an existing warehouse. You may need tune the warehouse size later, depending on your query size or complexity. Please see the Snowflake documentation for more details.

    SQL
    -- not required if reusing another warehouse
    CREATE WAREHOUSE customerio_reverse_etl
     WITH WAREHOUSE_SIZE = 'XSMALL'
       WAREHOUSE_TYPE = 'STANDARD'
       AUTO_SUSPEND = 600 -- 10 minutes
       AUTO_RESUME = TRUE;
  3. Create a specific role for Customer.io. Snowflake access is specified through roles. You’ll assign a role to the user you’ll create later. The following is an example of how you might set up the role:

    SQL
    -- create role
    CREATE ROLE customerio_reverse_etl;
    
    -- warehouse access
    -- change the name if reusing another warehouse
    GRANT USAGE ON WAREHOUSE customerio_reverse_etl TO ROLE customerio_reverse_etl;
    
    -- table access
    -- change the names to match the schema, database and table you want to use
    GRANT USAGE ON DATABASE my_database TO ROLE customerio_reverse_etl;
    GRANT USAGE ON SCHEMA my_database.my_schema TO ROLE customerio_reverse_etl;
    GRANT SELECT ON TABLE my_database.my_schema.my_table TO ROLE customerio_reverse_etl;
  4. In your terminal, generate a private key and the public key that goes with it. The first command creates an unencrypted private key in the format Customer.io supports. The second command reads the private key and writes out its public key.

    BASH
    # Generate an unencrypted private key
    openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
    
    # Generate the public key from the private key
    openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub

    Keep rsa_key.p8 somewhere secure. You’ll paste it into Customer.io when you set up your integration. Snowflake’s own guide recommends an encrypted private key, but the Snowflake driver that Customer.io uses to connect doesn’t support encrypted keys. Make sure you keep the -nocrypt option.

  5. Print the public key as a single line without its -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines. Snowflake expects the key in this form.

    BASH
    grep -v "PUBLIC KEY" rsa_key.pub | tr -d '\n'
  6. Run this code in your Snowflake worksheet to create the user that Customer.io signs in as. Replace your_public_key... with the public key you printed in the previous step.

    SQL
    -- create user
    CREATE USER customerio_reverse_etl_user
     TYPE = SERVICE
     DEFAULT_ROLE = customerio_reverse_etl
     RSA_PUBLIC_KEY = 'your_public_key...';
    
    -- role access
    GRANT ROLE customerio_reverse_etl TO USER customerio_reverse_etl_user;

    TYPE = SERVICE tells Snowflake that this user is a service rather than a person. Snowflake doesn’t let service users sign in with a password, so the key pair is the only way to sign in as this user.

Private key requirements

Customer.io supports unencrypted RSA private keys in the PKCS#8 PEM format.

If you already have a private key and you’re not sure what format it’s in, check the last line of the key. The format we support ends with: -----END PRIVATE KEY-----

If your key is encrypted

If your private key starts with -----BEGIN ENCRYPTED PRIVATE KEY-----, you’ll need to decrypt it before you can use it in Customer.io:

BASH
openssl pkcs8 -in encrypted_key.pem -nocrypt -out decrypted_key.pem

Converting from PKCS#1 format

We recommend that you generate a new key pair for Customer.io rather than reuse a key that other systems rely on. If you want to use a key you already have in the older PKCS#1 format (ending with -----END RSA PRIVATE KEY-----), you can convert it to the format we support by running:

BASH
# Convert from PKCS#1 to PKCS#8 (unencrypted)
openssl pkcs8 -topk8 -inform PEM -outform PEM -in existing_key.pem -out new_key.p8 -nocrypt

Set up your Snowflake integration

Set up your integration with an AI agent

Connect your AI coding agent to Customer.io’s MCP or the CLI. When you add this integration in the Customer.io UI, you’ll see a prompt under Set up with an agent that you can pass to your coding agent. With the Customer.io MCP or CLI tools, these prompts can help you set up your integration with minimal effort.

Switch password sign-in to key-pair authentication

Snowflake is retiring password sign-ins for services like Customer.io, and enforcement reaches each Snowflake account on its own schedule through October 2026. If Customer.io shows you a banner asking you to switch to key-pair authentication, follow the steps to switch an existing connection to key-pair authentication.

Before you set up your integration, make sure that you’ve set up your Snowflake connector and generated the private key that we’ll use to authenticate with Snowflake first. You’ll use the user, role, and private key you generate in that process when you set up your integration in Customer.io.

  1. Go to Integrations. In the Directory tab, pick the Snowflake Data in integration.

  2. Provide your database information, including credentials to connect to your database, and click Connect.

    • The Name is a friendly name you’ll use to recognize your database in Customer.io.
    • The Account name is your Snowflake account identifier: the part of your Snowflake URL before .snowflakecomputing.com. For example, if your Snowflake URL is cio-testing.us-west-2.snowflakecomputing.com, enter cio-testing.us-west-2.
    • Enter the Database and Warehouse you granted the Customer.io role access to.
    • Enter the Role and Username of the user you created for Customer.io. This must be the user you registered the public key for.
    • Copy the contents of your private key file (rsa_key.p8), including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines, into the Private key field. See private key requirements.
    connect your database
  3. Set up a Sync. A sync is the type of data (identify, track, etc) you want to import from your database and click Next: Define Query. You can set up syncs for each type of data you want to import.

    1. Provide a Name and Description for the sync. This helps you understand the sync at a glance when you look at your integration’s Overview later.
    2. Select the type of data you want to import.
    3. Set the Sync Frequency, indicating how often you want to query your database for new data. You should set the frequency such that sync operations don’t overlap. Learn more about sync frequency.
    4. Select when you want to start the sync: whether you want to begin importing data immediately, or schedule the sync to start at a later date.
      add a sync and determine the data you want to capture
  4. Enter the query that selects the data you want to import. See Queries for each sync type for what each sync type expects and for examples written for your database. Click Run Query to preview results and make sure that your query selects the right information.

    set up your query to sync the right information
  5. Click Enable to enable your sync.

Now you can set up additional syncs and connect your integration to one or more destinations.

Switch an existing connection to key-pair authentication

If you set up your Snowflake connection with a password, Customer.io shows a banner on your Snowflake integration that lists the connections you need to update. Snowflake is ending support for password-based authentication and will block these password sign-ins when its enforcement reaches your account. This will stop your syncs. You need to switch each connection to key-pair authentication before then.

A Snowflake user holds one public key in its RSA_PUBLIC_KEY property. If more than one connection signs in as the same Snowflake user, generate and register one key pair for that user, and paste the same private key into each of those connections. If you generate a new key for each connection, each new key replaces the one before it, and the connections you already switched can’t sign in.

  1. In your terminal, generate a private key and its public key, and print the public key as a single line:

    BASH
    openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
    openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
    grep -v "PUBLIC KEY" rsa_key.pub | tr -d '\n'
  2. In a Snowflake worksheet, register the public key on the user you set up for Customer.io. Replace customerio_reverse_etl_user with your user’s name and your_public_key... with the public key you printed.

    SQL
    ALTER USER customerio_reverse_etl_user SET RSA_PUBLIC_KEY = 'your_public_key...';

    Run this command with a role that owns the user or has the MODIFY PROGRAMMATIC AUTHENTICATION METHODS privilege. If Snowflake tells you that you don’t have permission, you may need to ask your Snowflake administrator for help.

  3. In Customer.io, go to your Snowflake integration and click the Databases tab.

  4. Find the database you want to update and click Edit.

  5. Paste the contents of rsa_key.p8 into the Private key field and click Save database. Customer.io tests the connection with the new key before it saves your changes.

  6. (Optional) You can remove the password from the Snowflake user and mark it as a service user, so that nobody can sign in as the user with a password. Customer.io doesn’t use the password after you save the key, so your syncs don’t depend on this step. Only do this if the user exists just for Customer.io, and after everything that signs in as the user has switched to the key.

    SQL
    ALTER USER customerio_reverse_etl_user UNSET PASSWORD;
    ALTER USER customerio_reverse_etl_user SET TYPE = SERVICE;

    Run these commands in this order. If you change the user’s type first, Snowflake keeps the password stored and hidden, and it restores the password if anyone changes the user back to a person.

If the connection test fails, check that you registered the public key on the same user that’s in the Username field, and that your private key meets the private key requirements.

Adding syncs

After you set up your incoming integration, you can add additional syncs to import different types of data from your database. For example, you might want to import identify data for your users, and track data for their actions. Subsequent syncs can rely on your existing database, or you can add another database within your integration.

  1. In your integration, go to the Syncs tab and click Add Sync.
  2. Select your database or add a new one and click Next: Create Sync.
  3. Set up a sync and click Next: Define Query. You can set up syncs for each type of data you want to import.
    1. Provide a Name and Description for the sync. This helps you understand the sync at a glance when you look at your integration’s Overview later.
    2. Select the type of data you want to import.
    3. Set the Sync Frequency, indicating how often you want to query your database for new data. You should set the frequency such that sync operations don’t overlap. Learn more about sync frequency.
    4. Select when you want to start the sync: whether you want to begin importing data immediately, or schedule the sync to start at a later date.
      add a sync and determine the data you want to capture
  4. Enter the query that selects the data you want to import. See Queries for each sync type for what each sync type expects and for examples written for your database. Click Run Query to preview results and make sure that your query selects the right information.
    set up your query to sync the right information
  5. Click Enable to enable your sync.

Sync Frequency

You can sync data as often as every minute. However, we recommend that you set your sync frequency such that sync operations don’t overlap. If you schedule syncs such that a sync operation is scheduled to start while the previous operation is still we’ll skip the next sync operation.

Each sync runs on your Snowflake virtual warehouse, so your sync frequency affects your Snowflake bill:

  • Each resume bills at least a minute. Snowflake bills per second with a 60-second minimum every time a warehouse resumes. Syncs that run more often than your auto-suspend timeout keep the warehouse running, and syncs that run less often wake it each time.
  • Set auto-suspend to match your schedule. If your syncs are far apart, a short auto-suspend timeout lets the warehouse stop between them.
  • Start small. Each warehouse size up doubles the credits per hour, so start with a small warehouse and size up only if individual syncs run slowly.

Semantic events: Deleting people, groups, and more

You may notice that this integration doesn’t have sync types to delete people, groups, or other objects. To do these kinds of operations, you’ll use what we call semantic events. These are events with specific names that indicate a delete operation. When your Track sync picks up events with an event name we recognize, we’ll perform the associated action—like deleting a person or group.

For example, if you send an event with the name User Deleted, we’ll delete the person from your workspace. See Customer.io Semantic Events for more information.

The semantic events we support are:

Event NameAction
Device Created or UpdatedAdd or update a mobile device.
Device DeletedDelete a mobile device.
User DeletedDelete a person.
Object DeletedDelete a custom object.
Relationship DeletedDelete a relationship.
User SuppressedSuppress a person.
User UnsuppressedUnsuppress a person.
Report Delivery EventReport in-app message events (like delivery, open, click) outside of our JavaScript integration.
Updated November 20, 2026