Tutorials

How to integrate Snowflake and Zapier | Census

Ukpai Ugochi November 01, 2022

There’s so much you can do with data, but it can be frustrating and overwhelming when you can’t process it into useful information. 

This is where services like Snowflake come into play, allowing data analysts and engineers to process and manage their data efficiently without the fuss. 

🤔 But how do you route this data across work-related suites? Do you have to repeat the same process in every suite? In this article, we’ll explore workflow automation with Zapier and how to route data from Snowflake.

What’s Snowflake?

One of the best things about cloud computing is the ability for users to pay as they go and access services anywhere from the internet. And Snowflake is just one of the cloud-based data computing services that enable data folks to collaborate both locally and globally. Instead of traditional data silos that are generally inaccessible, Snowflake allows all necessary teams access to data. 🤝

With that said, most Snowflake users know all about its benefits: How scalable it is, how it can store your data, and the loads of cool features under its belt. But until recently, most customers were thinking about using the data stored there solely for business intelligence and dashboards. 

🌊 Now, the tides are turning, and Snowflake is becoming more of a center for business operations instead of “just a data warehouse.” To really capitalize on its power, we need to connect it to the apps that people use every day – like Slack and, of course, Zapier.

Workflow automation with Zapier

When developers incorporate workflow automation into their system, it makes their work easier. Think of any repetitive process that you complete over and again. With workflow automation tools like Zapier, teams can automate their workflows and Zap from point A to point B. 

This comes with some perks like the ability to share data across the different layers that require them. Zapier not only allows you to automate your workflow, but it also allows you to integrate web applications of your choice.

Why would you want workflow automation?

  • Faster response. Incorporating workflow automation into your execution process allows for faster execution and response times because the time needed for human intervention has effectively been eliminated. ⏰
  • Reduced error. Since work processes run automatically, they are devoid of human error. After writing workflow rules and testing them, they should run successfully over and over again. 🔁
  • Proper communication. Employees can communicate better and reduce setbacks as they work.
  • Avoid repetitive tasks. By grouping all tasks that follow the same process in one batch, they run automatically without human intervention. 🙅

Creating a new Snowflake-Zapier integration

So, how do you set this workflow automation up? We’ve created an example scenario to show you how to manually set up a Snowflake 👉 Zapier integration to fetch data from a SQL table. First, set up a Snowflake account and a data warehouse using the code samples in the Snowflake documentation.

Setting up Snowflake

You need actual data in your warehouse before it can be considered a data warehouse. In this tutorial, we’ll fetch data from a SQL database. After that, we’ll use the Snowflake Node.js driver to make a connection. You can install the sdk with npm.

npm install snowflake-sdk

After installing snowflake-sdk, we’ll make a connection. Snowflake also has the single and pool connection option so that you don’t have to create a connection each time your client application needs to access Snowflake. However, for the purpose of this tutorial, we’ll create a single connection.

// Load the Snowflake Node.js driver.
var snowflake = require('snowflake-sdk’); // Create a Connection object that we can use later to connect. var connection = snowflake.createConnection({ ... authenticator: "OAUTH", token: "<your_oauth_token>" }); // Try to connect to Snowflake, and check whether the connection was successful. connection.connect( function(err, conn) { if (err) { console.error('Unable to connect: ' + err.message); } else { console.log('Successfully connected to Snowflake.');        
 			// Optional: store the connection ID.
            connection_ID = conn.getId();
            }
    }
);

In the code above, we’re using OAUTH for authentication, so you’ll need to add your OAUTH_TOKEN. Hint: It's best to store your OAUTH_TOKEN as a secret in an .ENV file. Next, you can upload a file containing your data to Snowflake stage using the PUT command.

connection.execute({
  sqlText: 'PUT file://C:\\Users\\Username\\Files\\employees0*.csv @DATABASE.SCHEMA.%TABLE;',
  complete: function (err)
  {
    var stream = statement.streamRows();
    stream.on('data', function (row)
    {
      console.log(row);
    });
    stream.on('end', function (row)
    {
      console.log('All rows consumed');
    });
  }
});

Now that you have data in internal storage, let’s implement the Zapier integration.

Setting up Zapier

Set up a Webhooks trigger for your Snowflake application. If you don’t already have a Zapier account, follow this link to get one. Then navigate to your dashboard and click the Create Zap button.

Next, chose the Webhook button to create a Zapier to Snowflake Webhook.

This will take you to the Webhooks page. If you’re using the premium version of Zapier, you can use Webhooks by Zapier by clicking on the Webhooks by Zapier button. Otherwise, click the Event dropdown and choose the event that suits you. 

For the purpose of this tutorial, we chose the Retrieve poll event. This type of event checks your application regularly. And, if there’s any new information, it compares the item's unique ID to those it has already received.

In the Retrieve poll event, you’ll need to provide information like basic authentication, keys, header, URL, etc.

The next page will ask you to test the Webhook trigger. If the information you added is correct, you should see some data.

 Test Webhook Trigger
Test Webhook Trigger

At this point, you can add actions to the Webhook trigger using one of the built-in apps in Zapier. When this is set, you’ll be given the URL for your Webhook and can set it up. Don’t forget to name your Zap and publish it when you’re ready. 💡

Is there a better way?

In this article, we explored workflow automation with Zapier and how to integrate Snowflake as a data source. While we can create a workflow integration with Zapier and Snowflake manually as shown in the tutorial above, it can take a lot of time to set up. 

And, since the goal of automation is to speed up workflow execution as well as the overall efficiency of the program, it's a bit counterproductive if you have to spend time setting up an automated workflow. Plus, most integrations like Zapier evolved without consideration for other evolutions happening in parallel (like the accessibility and power of a data warehouse as a source of truth).

The plug-and-play nature of point-to-point platforms like Workato, Zapier, or Mulesoft often entices teams with quick fixes. But relying too heavily on these duct tape solutions can quickly get messy. Fully integrating point-to-point solutions requires exponentially more connections as your stack grows, adding more complexity to your tools and increasing your costs. 

Tools like Census reverse ETL provide a faster and more efficient way to create Zapier 👉 Snowflake integrations. So, instead of a messy, spaghetti pile of point-to-point integrations, you can use reverse ETL to architect your data infrastructure as a series of orderly spokes around your central hub (data warehouse).

In fact, Census allows you to choose Zapier as your destination integration and add Snowflake as your data source with just a few clicks. To learn more about Census and how to quickly incorporate source and destination integrations with web applications of our choice, request a demo to get started!

Related articles

Customer Stories
Built With Census Embedded: Labelbox Becomes Data Warehouse-Native
Built With Census Embedded: Labelbox Becomes Data Warehouse-Native

Every business’s best source of truth is in their cloud data warehouse. If you’re a SaaS provider, your customer’s best data is in their cloud data warehouse, too.

Best Practices
Keeping Data Private with the Composable CDP
Keeping Data Private with the Composable CDP

One of the benefits of composing your Customer Data Platform on your data warehouse is enforcing and maintaining strong controls over how, where, and to whom your data is exposed.

Product News
Sync data 100x faster on Snowflake with Census Live Syncs
Sync data 100x faster on Snowflake with Census Live Syncs

For years, working with high-quality data in real time was an elusive goal for data teams. Two hurdles blocked real-time data activation on Snowflake from becoming a reality: Lack of low-latency data flows and transformation pipelines The compute cost of running queries at high frequency in order to provide real-time insights Today, we’re solving both of those challenges by partnering with Snowflake to support our real-time Live Syncs, which can be 100 times faster and 100 times cheaper to operate than traditional Reverse ETL. You can create a Live Sync using any Snowflake table (including Dynamic Tables) as a source, and sync data to over 200 business tools within seconds. We’re proud to offer the fastest Reverse ETL platform on the planet, and the only one capable of real-time activation with Snowflake. 👉 Luke Ambrosetti discusses Live Sync architecture in-depth on Snowflake’s Medium blog here. Real-Time Composable CDP with Snowflake Developed alongside Snowflake’s product team, we’re excited to enable the fastest-ever data activation on Snowflake. Today marks a massive paradigm shift in how quickly companies can leverage their first-party data to stay ahead of their competition. In the past, businesses had to implement their real-time use cases outside their Data Cloud by building a separate fast path, through hosted custom infrastructure and event buses, or piles of if-this-then-that no-code hacks — all with painful limitations such as lack of scalability, data silos, and low adaptability. Census Live Syncs were born to tear down the latency barrier that previously prevented companies from centralizing these integrations with all of their others. Census Live Syncs and Snowflake now combine to offer real-time CDP capabilities without having to abandon the Data Cloud. This Composable CDP approach transforms the Data Cloud infrastructure that companies already have into an engine that drives business growth and revenue, delivering huge cost savings and data-driven decisions without complex engineering. Together we’re enabling marketing and business teams to interact with customers at the moment of intent, deliver the most personalized recommendations, and update AI models with the freshest insights. Doing the Math: 100x Faster and 100x Cheaper There are two primary ways to use Census Live Syncs — through Snowflake Dynamic Tables, or directly through Snowflake Streams. Near real time: Dynamic Tables have a target lag of minimum 1 minute (as of March 2024). Real time: Live Syncs can operate off a Snowflake Stream directly to achieve true real-time activation in single-digit seconds. Using a real-world example, one of our customers was looking for real-time activation to personalize in-app content immediately. They replaced their previous hourly process with Census Live Syncs, achieving an end-to-end latency of <1 minute. They observed that Live Syncs are 144 times cheaper and 150 times faster than their previous Reverse ETL process. It’s rare to offer customers multiple orders of magnitude of improvement as part of a product release, but we did the math. Continuous Syncs (traditional Reverse ETL) Census Live Syncs Improvement Cost 24 hours = 24 Snowflake credits. 24 * $2 * 30 = $1440/month ⅙ of a credit per day. ⅙ * $2 * 30 = $10/month 144x Speed Transformation hourly job + 15 minutes for ETL = 75 minutes on average 30 seconds on average 150x Cost The previous method of lowest latency Reverse ETL, called Continuous Syncs, required a Snowflake compute platform to be live 24/7 in order to continuously detect changes. This was expensive and also wasteful for datasets that don’t change often. Assuming that one Snowflake credit is on average $2, traditional Reverse ETL costs 24 credits * $2 * 30 days = $1440 per month. Using Snowflake’s Streams to detect changes offers a huge saving in credits to detect changes, just 1/6th of a single credit in equivalent cost, lowering the cost to $10 per month. Speed Real-time activation also requires ETL and transformation workflows to be low latency. In this example, our customer needed real-time activation of an event that occurs 10 times per day. First, we reduced their ETL processing time to 1 second with our HTTP Request source. On the activation side, Live Syncs activate data with subsecond latency. 1 second HTTP Live Sync + 1 minute Dynamic Table refresh + 1 second Census Snowflake Live Sync = 1 minute end-to-end latency. This process can be even faster when using Live Syncs with a Snowflake Stream. For this customer, using Census Live Syncs on Snowflake was 144x cheaper and 150x faster than their previous Reverse ETL process How Live Syncs work It’s easy to set up a real-time workflow with Snowflake as a source in three steps: