# Snowflake

## Overview

HockeyStack’s Snowflake integration allows you to seamlessly connect your Snowflake instance to our platform. This custom-built connector is designed to pull in data from Snowflake based on your unique infrastructure and analytics needs. Typical use cases include:

* Pulling specific user profile data to enrich your analytics
* Mapping offline revenue opportunities to your CRM activities
* Incorporating additional custom data points that help unify your customer data story

If you’re unsure about what data is most valuable to pull, we’re happy to schedule a call to help you determine which tables and fields will best support your use cases.

## Prerequisites

Before we begin, please ensure you have:

* Access to your Snowflake instance with the ability to manage users, permissions, and network policies.
* Clear information on which Snowflake tables, databases, and columns contain the data you’d like HockeyStack to ingest.
* An understanding of whether HockeyStack should have read-only access, or if write permissions are also needed (for pushing data back to Snowflake).

## Connecting to Snowflake

To establish a secure connection between HockeyStack and Snowflake, follow these steps:

1. **User Invitation (if using email-based authentication):**\
   Invite `dev@hockeystack.com` to your Snowflake instance. This grants HockeyStack the ability to authenticate and connect.
2. **IP Whitelisting (if applicable):**\
   If you have IP restrictions in place, whitelist the following IP addresses to allow HockeyStack’s workers to communicate with Snowflake:
   * `18.184.228.143`&#x20;
   * `18.192.106.69` &#x20;
   * `35.157.54.242`&#x20;
   * `3.69.98.171` &#x20;
3. **Assigning Permissions:**\
   Decide whether HockeyStack should have read-only or read-write permissions, depending on your use case. Please create a [Role](https://docs.snowflake.com/en/sql-reference/sql/create-role) that HockeyStack can use to access necessary databases, schemas and tables. Then, create a [User](https://docs.snowflake.com/en/sql-reference/sql/create-user) that can access this role either using a password or a key-pair.&#x20;
   1. Extra Resources:
      1. [tutorial on creating a user a granting roles ](https://docs.snowflake.com/en/user-guide/tutorials/users-and-roles-tutorial)
      2. [more information on creating a Key-Pair](https://docs.snowflake.com/en/user-guide/key-pair-auth)&#x20;
   2. **When you are finished creating the role,** please provide us with the following in the secure manner of your choice. (Popular choices are [One Time Secret](https://onetimesecret.com/), or [1Password](https://1password.com/))**:**
      1. **Account** (usually, abc-xyz.snowflakecomputing.com)
      2. **Warehouse**&#x20;
      3. **Database**
      4. **Schema**
      5. **Table**
      6. **Username**
      7. **Password or Private Key** (and private key password, if encrypted).&#x20;
4. **Node.js Integration Details:**\
   We connect using Node.js workers to ensure a stable and efficient integration. For more technical details on how the Node.js connector works, refer to Snowflake’s official documentation:\
   [Node.js Snowflake Driver Connect Docs](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-connect)

## Pulling Data from Snowflake

HockeyStack runs scheduled workers (typically daily, though this can be customized) to pull data from your Snowflake instance. The process is as follows:

1. **Initial Historical Backfill:**\
   We start by running a full backfill of your historical data. This ensures that HockeyStack has all necessary historical records before moving on to incremental updates. Depending on the size of your data and infrastructure, this can take some time.
2. **Ongoing Incremental Updates:**\
   After the initial backfill, HockeyStack’s daily (or otherwise scheduled) jobs will query your specified Snowflake tables to fetch any new or updated data. This process continues until the connection is closed or modified.
3. **Data Processing:**\
   The pulled data is processed on HockeyStack’s servers and inserted into our database, making it available for analysis, reporting, and integrations.

## Pushing Data into Snowflake

If you need to send data from HockeyStack back into Snowflake, we can configure a daily sync to your Snowflake table. This will start with an initial export backfill of all tracked data for your export type, and recur on a daily basis with incremental additions.&#x20;

**Data Formatting:**\
Our workers query HockeyStack’s database, and export either raw actions or stage data to your destination table.

***

**If you have any questions, need more details on the integration process, or want to discuss the specifics of your data pulls, please reach out to our support team. We’re here to help make sure your Snowflake integration is set up seamlessly and supports your analytics goals.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hockeystack.com/integrations/analytics-and-data-warehouse/snowflake.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
