Getting up and running with Segment is easy. In only a few steps, Segment automatically begins collecting activities on your website and within your application. But what about information that is locked in Snowflake tables that doesn’t get automatically pulled into your workspace? They contain full customer profiles and years of web and app activity that you don’t want to exclude.
You're in luck; Segment offers a solution for this!
Segment’s libraries allow you to stream data in from a variety of sources to handle many backfill requests. But sometimes that requires additional work on your side to expose that data and code correct payloads. With reverse ETL, Segment allows you to connect directly to those views or tables and pull data in using a point and click mapping interface. You no longer need to build JSON payloads with code for backfill because Segment provides you with the tools to streamline this process and immediately add relevant data to your workspace.
You’ll learn how to connect to the Snowflake views containing events and profile data and map that data to identify and track calls all within the intuitive interface.
In your Segment workspace, navigate to Reverse ETL -> Sources and click Add Source.
Select Snowflake and then name your source on the Basic Settings tab.
Have your Snowflake Account ID, Database Name, Warehouse, Username, and Password available and follow the instructions on the Connection Settings tab to connect your Snowflake source.
We will start with profile data and send identify calls directly into your workspace. In your Segment workspace, under Reverse ETL -> Sources, click into your newly created Snowflake source and select Add Model -> SQL Editor.
Example 1: Identify Events (updating and adding customer profiles)
Create your SQL query to pull the data from your Snowflake table. An example query for this model would look like this for a table with customer records: SELECT userId, email, firstName, lastName, plan, street, city, state, postalCode, country, phone, birthday, createdAt, updatedAt, gender FROM ACME_MDWHO.ACME_PRODUCTION.CUSTOMERS
Enter userID as the unique identifier column below the query.
Preview the results to ensure there are no errors.
Enter a name for the model (i.e. Customer Records), and set how frequently you would like it to be performed. If you want this only to happen once, you can choose 1 hour and then disable the connection once the initial pull has successfully completed.
Example 2: Track Events (adding customer order completed events)
Create your SQL query to pull the data from your Snowflake table. An example query for this model would look like this for a table of order completed events: SELECT orderId, userId, email, orderDate, total, shipping, tax, currency, discount, affiliation FROM ACME_MDWHO.ACME_PRODUCTION.ORDERS
Enter orderID as the unique identifier column below the query.
Preview the results to ensure there are no errors.
Enter a name for the model (i.e. Order Completed), and set how frequently you would like it to be performed. If you want this only to happen once, you can choose 1 hour and then disable the connection once the initial pull has successfully completed.
In your Segment workspace, navigate to Reverse ETL -> Destinations and select Add Destination.
Select Segment and connect it to the Snowflake source.
Name the Conversion and add the Source Write Key which you can find by opening a new tab and navigating to an existing source within your workspace, selecting the Settings tab and copying the Write Key. In this example we are using an HTTP API source. You can create a new source specifically for rETL or use an existing source. It is recommended that you test this with a new HTTP API source and while testing you don’t connect to Engage because you will be making real time updates and entries to your customer profiles.