Docs
Tracking Methods
Data Warehouse
Snowflake Setup

Snowflake

Complete the following steps to get your Snowflake connector up and running:

  1. Navigate to Project Settings, then select Warehouse Sources.
  2. Click on + Add Connection and select Snowflake.
  3. You should see a new page to create your snowflake connector. In the first view, fill out the following fields before clicking Next:
    • Snowflake Account Name / URL
    • Username
    • Role
    • Authentication Type. We support both Password and Key Pair. Ensure that the corresponding commands have been successfully completed in your Snowflake instance.
      • For Password authentication:
        • Fill out the password field.
        • Copy the commands and run them within your Snowflake instance.
        • Be sure to fill out the password field in your command.
      • For Key Pair authentication:
        • Mixpanel will generate a secure key pair for your source per the Snowflake requirements.
        • The private key will be encrypted and stored securely, and used only when we need to communicate with your Snowflake instance.
        • Public key can be found in the suggested SQL to create your user.
  4. In the second view, you can click Create Source after completing the following:
    • Warehouse

      • Enter the name of your warehouse (default value: MIXPANEL_IMPORT_WAREHOUSE).

      • We recommend creating a separate warehouse for Mixpanel, and ensuring that Mixpanel has the appropriate role permissions to access it.

      • Run the commands below in Snowflake.

        CREATE WAREHOUSE MIXPANEL_IMPORT_WAREHOUSE WITH WAREHOUSE_SIZE = XSMALL AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = FALSE;
        GRANT USAGE ON WAREHOUSE MIXPANEL_IMPORT_WAREHOUSE TO ROLE MIXPANEL_IMPORT_ROLE;
        GRANT OPERATE ON WAREHOUSE MIXPANEL_IMPORT_WAREHOUSE TO ROLE MIXPANEL_IMPORT_ROLE;
        GRANT MONITOR ON WAREHOUSE MIXPANEL_IMPORT_WAREHOUSE TO ROLE MIXPANEL_IMPORT_ROLE; 
    • Storage Integration

      • This is required because Mixpanel will export the query results into a GCS bucket.
      • Default value: MIXPANEL_IMPORT_STORAGE_INTEGRATION
      CREATE STORAGE INTEGRATION MIXPANEL_IMPORT_STORAGE_INTEGRATION
        TYPE = EXTERNAL_STAGE
        STORAGE_PROVIDER = 'GCS'
        ENABLED = TRUE
        STORAGE_ALLOWED_LOCATIONS = ("gcs://mixpanel-2946576-ca470bce1e1ed2ec");
      GRANT USAGE ON INTEGRATION MIXPANEL_IMPORT_STORAGE_INTEGRATION TO MIXPANEL_IMPORT_ROLE; 
    • Database (optional)

      • Enter the name of the database you want to grant permission to.
      • By default, we request read-only access.
      • Mixpanel does not store the access information. However, you can choose to provide more granular access if you desire.
      GRANT USAGE ON DATABASE "<your_data_base>" TO ROLE MIXPANEL_IMPORT_ROLE;
      GRANT USAGE ON ALL SCHEMAS IN DATABASE "<your_data_base>" TO ROLE MIXPANEL_IMPORT_ROLE;
      GRANT SELECT ON ALL TABLES IN DATABASE "<your_data_base>" TO ROLE MIXPANEL_IMPORT_ROLE;
      GRANT SELECT ON ALL VIEWS IN DATABASE "<your_data_base>" TO ROLE MIXPANEL_IMPORT_ROLE;
      GRANT SELECT ON ALL MATERIALIZED VIEWS IN DATABASE "<your_data_base>" TO ROLE MIXPANEL_IMPORT_ROLE;

IP Allowed List

If you are using Snowflake Network policy (opens in a new tab) to restrict access to your instance, you might need to add the following IP addresses to the allowed list.

34.31.112.201
34.147.68.192
35.184.21.33
35.225.176.74
35.204.164.122
35.204.177.251

Mirror Sync Readiness

Mirror syncing is in early access and not available on all projects. Request access here.

Mirror syncs use Snowflake streams (opens in a new tab) to track all changes (inserts, updates, and deletes) to source tables. CHANGE_TRACKING (opens in a new tab) must be enabled on a Snowflake table in order for a Mirror sync to be created from it.

ALTER TABLE <database>.<schema>.<table> SET CHANGE_TRACKING = TRUE;

When using Mirror syncs Mixpanel creates and manages Snowflake streams in the source warehouse and needs the CREATE STREAM permission on a Snowflake schema to store these streams. We recommend creating a new empty schema solely for Mixpanel. For example:

CREATE DATABASE IF NOT EXISTS MIXPANEL_STREAM_DATABASE;
CREATE SCHEMA IF NOT EXISTS MIXPANEL_STREAM_DATABASE.MIXPANEL_STREAM_SCHEMA;
 
-- Grant your Mixpanel role access to create streams in the schema
GRANT USAGE ON DATABASE MIXPANEL_STREAM_DATABASE TO ROLE MIXPANEL_IMPORT_ROLE;
GRANT USAGE ON SCHEMA MIXPANEL_STREAM_DATABASE.MIXPANEL_STREAM_SCHEMA TO ROLE MIXPANEL_IMPORT_ROLE;
GRANT CREATE STREAM ON SCHEMA MIXPANEL_STREAM_DATABASE.MIXPANEL_STREAM_SCHEMA TO ROLE MIXPANEL_IMPORT_ROLE;

To create a new Mirror-ready Snowflake source follow the steps above and fill out the additional two fields "Stream Database" and "Stream Schema" in step 4.

To update an existing source to be Mirror-ready:

  1. Navigate to Project Settings, then select Warehouse Sources.
  2. Find the source to update. The source's card should include a note Mirror: Additional Setup Required. Click "Additional Setup Required" to be taken to the source configuration page.
  3. Fill in the two fields "Stream Database" and "Stream Schema". Press Save.

Was this page useful?