> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Linking Snowflake as a source Canonical URL: https://posthog.com/docs/data-pipelines/sources/snowflake > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.posthog.com` instead of `https://app.posthog.com` (app host for links). ## On this page - [Direct Snowflake connections](#direct-snowflake-connections) - [Troubleshooting](#troubleshooting) - [Configuration](#configuration) - [Selecting columns](#selecting-columns) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_9608fcca70) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_dark_a92b0e022d) Let AI connect your sources for you Skip the manual setup โ€” run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog. `npx @posthog/wizard warehouse` ![PostHog Wizard hedgehog](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png) ![](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png)Let AI connect your sources for you The data warehouse can link to data in Snowflake. Start by going to the [Data pipeline page](https://app.posthog.com/data-management/sources) and the sources tab and clicking **New source**. Choose Snowflake and enter the following data: - **Account identifier**: Likely a combination of your organization and the name of the account (e.g. `myorg-account123`). You can find this in the sidebar account selector or by executing the `CURRENT_ACCOUNT_NAME` and `CURRENT_ORGANIZATION_NAME` functions in SQL. - **Database**: Like `tasty_bytes_sample_data` - **Warehouse**: Like `compute_wh` - **User**: Your username like `IANVPH` - **Password**: The password for your user - **Role (optional)**: The role with necessary privileges to access your context like `accountadmin`. - **Schema**: The schema for your database like `RAW_POS`. If it isn't working, trying using all caps. - **Table Prefix:** The optional prefix for your tables in PostHog. For example, if your table name ended up being `menu`, a prefix of `snow_prod_` would create a table in PostHog called `snow_prod_menu`. ![Snowflake details](https://res.cloudinary.com/dmukukwp6/image/upload/Clean_Shot_2024_07_23_at_13_50_56_2x_c31bfa6237.png) Once added, click **Next**, select the tables you want to sync, as well as the [sync method](https://posthog.com/docs/data-pipelines/sources.md#incremental-vs-full-table), and then press **Import**. Once done, you can now [query](https://posthog.com/docs/data-warehouse/query.md) your new table using the table name. ![Snowflake details](https://res.cloudinary.com/dmukukwp6/image/upload/Clean_Shot_2024_07_23_at_13_56_32_2x_9c0bc2d35f.png) ## Direct Snowflake connections Instead of syncing data on a schedule, you can query your Snowflake database directly from the [SQL editor](https://app.posthog.com/sql). Direct connections run queries against your live Snowflake instance in real time โ€” no data is copied into PostHog. ### Creating a direct-only connection To set up a direct connection: 1. Open the [SQL editor](https://app.posthog.com/sql). 2. Click the connection picker in the toolbar and select **Add direct connection** > **Snowflake**. 3. Enter your Snowflake credentials (account identifier, database, warehouse, user, password, and optionally a role and schema) โ€” the same credentials used for scheduled syncs. 4. Select the tables you want to make available, then click **Link**. Once connected, switch to your Snowflake connection in the SQL editor's connection picker and write queries against your live data. ### Enabling live queries on a synced source You can also enable live queries on a synced Snowflake source, giving you both scheduled syncs and the ability to query your live data from the same source. **When creating a new source:** In the source creation wizard, select **Sync and query live** to enable both scheduled syncs and live queries. **For an existing source:** 1. Go to the [sources tab](https://app.posthog.com/data-management/sources) and click your Snowflake source. 2. Open the **Configuration** tab. 3. Enable the **Enable live queries** toggle. 4. Click **Save changes**. Once enabled, click **Query directly** on the **Schemas** tab to open the SQL editor with your source preselected. In the SQL editor's connection picker, synced sources with live queries show a `ยท synced` label to distinguish them from direct-only connections. ### When to use direct connections vs scheduled syncs - **Direct connections** are best for ad-hoc exploration, querying data that changes frequently, or when you don't want to duplicate data into PostHog. - **Scheduled syncs** are better when you need faster query performance, want to join external data with PostHog events in dashboards and insights, or need data available across all PostHog features. ### Limitations Direct Snowflake queries are read-only. Some HogQL constructs are not supported and return a clear error if used: - `SAMPLE` - `PREWHERE` - `ARRAY JOIN` - `LIMIT BY` - Tuple expressions - Array slices ## Troubleshooting ### Network policy blocking connection **Problem:** Your Snowflake sync fails with an error like: > Incoming request with IP/Token is not allowed to access Snowflake. Contact your account administrator. **Solution:** Your Snowflake account has a [network policy](https://docs.snowflake.com/en/user-guide/network-policies) (IP allowlist) that doesn't include PostHog's egress IP addresses. Ask your Snowflake administrator to add the IP addresses listed in the [Configuration](#configuration) section below to your network policy allowlist. Once updated, retry the sync. ### Invalid JWT token with key-pair authentication **Problem:** Your Snowflake sync fails with an error like: > JWT token is invalid **Solution:** Snowflake rejected key-pair authentication because the private key you configured doesn't match the public key registered on the Snowflake user. This can happen when: - The public key was rotated or removed from the Snowflake user - You pasted the wrong private key - The private key belongs to a different Snowflake user To fix this, verify that the public key matching your private key is registered on your Snowflake user. See [Snowflake's key-pair authentication documentation](https://docs.snowflake.com/en/user-guide/key-pair-auth) for instructions. Either re-register the matching public key on the Snowflake user, or update your PostHog source configuration with the correct private key. Once corrected, resync your data. ### Multi-factor authentication enrollment required **Problem:** Your Snowflake sync fails with an error like: > Multi-factor authentication is required for this account. Log in to Snowsight to enroll. **Solution:** The Snowflake account requires MFA enrollment, but the connecting user hasn't enrolled. PostHog runs unattended syncs that can't complete an MFA enrollment flow, so retrying never succeeds. To fix this, connect with a service user that uses [key-pair authentication](https://docs.snowflake.com/en/user-guide/key-pair-auth) (which bypasses MFA), or use a user account that is exempt from your account's MFA requirement. Once updated, resync your data. ## Configuration | Option | Type | Required | | --- | --- | --- | | `Connection string (optional)` | text | No | | `Account id` | text | Yes | | `Database` | text | Yes | | `Warehouse` | text | Yes | | `Authentication type` | select | Yes | | `Role (optional)` | text | No | | `Schema (optional)` | text | No | ## Selecting columns By default, PostHog syncs all columns from each table. To sync only specific columns: 1. During source setup, click **Columns** next to any table in the table picker. 2. Uncheck columns you don't want to sync. 3. Primary key columns and the incremental sync field (if configured) are always synced and cannot be disabled. You can also change column selection after setup: 1. Go to the [sources tab](https://app.posthog.com/data-management/sources) and click your Snowflake source. 2. Click **Configure** next to any schema. 3. Under **Columns**, select which columns to sync. **Adding columns to existing syncs** When you add columns to a schema using incremental or append sync, PostHog prompts you to choose: - **Sync forward only** - New columns are populated only for future data. Existing rows show `NULL` for the new columns. - **Full resync** - Triggers a complete resync to backfill the new columns for all rows. #### Inbound IP addresses We use a set of IP addresses to access your instance. To ensure this connector works, add these IPs to your inbound security rules: | US | EU | | --- | --- | | 44.205.89.55 | 3.75.65.221 | | 52.4.194.122 | 18.197.246.42 | | 44.208.188.173 | 3.120.223.253 |