> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake Data Export

> This topic explains how to create and test a Snowflake destination for Data Export.

**Developer**

**Federal docs**

> [!CAUTION]
>
> **This integration is not available in federal environments**
>
> To learn more, read [LaunchDarkly in federal environments](https://launchdarkly.com/docs/home/infrastructure/federal).

**EU docs**

> [!NOTE]
>
> **Data Export is an add-on feature**
>
> Data Export is available as an add-on feature to select plans. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To add Data Export to your plan, [contact Sales](https://launchdarkly.com/contact-sales/).

This topic explains how to create and test a Snowflake destination for Data Export. By exporting your LaunchDarkly experiment data to the same Snowflake warehouse as your other data, you can build custom reports in Snowflake to answer product behavior questions.

You can also run experiments using warehouse native metrics. To learn more, read [Creating experiments using warehouse native metrics](https://launchdarkly.com/docs/home/warehouse-native/creating.md).

You can use the Snowflake Data Export integration with cloud providers in any region.

## Prerequisites

To configure the Snowflake Data Export integration, you must have the following prerequisites:

* You must have the `ACCOUNTADMIN` user role in Snowflake
* You must have a [LaunchDarkly role](https://launchdarkly.com/docs/home/account/roles) that allows you to [add and edit integrations](https://launchdarkly.com/docs/home/account/roles/role-actions.md#integration-actions) and [add destinations](https://launchdarkly.com/docs/home/account/roles/role-actions.md#destination-actions)

**Developer**

* You need to allow LaunchDarkly's data transfer service’s static IP address: `35.192.85.117`

**EU docs**

* You need to allow LaunchDarkly's data transfer service’s static IP address: `35.241.154.37`

- You must know your Snowflake account URL. You can retrieve your Snowflake account/server URL by navigating to the user menu in Snowflake, hovering on **Account**, then clicking **View account details**:

![The "Copy account URL" option in Snowflake.](https://mintcdn.com/launchdarkly/ltwUrD5AmJ696YaX/images/__third_party/snowflake-copy-account-url.png?fit=max\&auto=format\&n=ltwUrD5AmJ696YaX\&q=85\&s=93b6dfec991728f3447a0e2b870cfcf3)

The "Copy account URL" option in Snowflake.

* If you use network policies within your Snowflake account, you must allow traffic from LaunchDarkly. The setup script you generate in the next section creates the required network rule and policy for you when you turn on the **Allowlist the LaunchDarkly IP** option.

> [!NOTE]
>
> **One Data Export destination per environment**
>
> You can configure only one Data Export destination per LaunchDarkly environment, regardless of destination kind. If you need more than one Data Export destination for the same data, configure them in different environments.

## Connect your LaunchDarkly environment to Snowflake

The Snowflake Data Export setup uses a two-step flow. First, you generate a setup script in LaunchDarkly. Then, you run the script in Snowflake and return to LaunchDarkly to test the connection and save your destination.

We recommend having two browser windows or tabs open to switch between LaunchDarkly and Snowflake.

When you set up the integration, LaunchDarkly generates a SQL script that creates the Snowflake objects the integration needs. You can use the default names or customize them in step 7 of the following procedure. To learn what the script creates, read [About the setup script](#about-the-setup-script).

To connect your LaunchDarkly environment to Snowflake:

1. In LaunchDarkly, click the **gear** icon in the left sidebar to view Organization settings.
2. Click **Integrations** and find "Snowflake Data Export."
3. Click **Add integration**. The Snowflake Data Export configuration page appears.
4. Give the integration a human-readable **Name**.
5. Choose a **Project and environment** to export data from. Environments that already have a Data Export destination are unavailable. When you choose an environment, LaunchDarkly fills in the default Snowflake object names for it.
6. Enter your **Snowflake account URL**.
7. (Optional) Customize any of the Snowflake object names listed below. If you leave a field blank, LaunchDarkly uses the default value. Each name can contain letters, digits, underscores, and `$`. Names must start with a letter or underscore and can be up to 255 characters. LaunchDarkly converts names to uppercase as you type.

   * **Database name**: Defaults to `LD_EXPORT`. Shared across all environments.
   * **Warehouse name**: Defaults to `LD_EXPORT_WH`. Shared across all environments.
   * **Schema name**: Defaults to `EXPORT_<projKey>__<envKey>`, where `<projKey>` is your project key and `<envKey>` is your environment key. LaunchDarkly converts both keys to uppercase and replaces each character other than a letter or digit with `_`. Unique to a project and environment.
   * **Role**: Defaults to `LD_EXPORT_ROLE`. Shared across all environments.
   * **Username**: Defaults to `LD_EXPORT_USER_<projKey>__<envKey>`, with the keys converted the same way. Unique to a project and environment.

   Each Data Export destination that connects to the same Snowflake account must use a different combination of database and schema, and a different user. If another destination already uses the schema or user you enter, LaunchDarkly displays an error when you generate the script.
8. (Optional) If your Snowflake account uses network policies, turn on **Allowlist the LaunchDarkly IP**. The generated script then creates the required Snowflake network rule and policy. When this option is on, the database and schema names cannot contain `$$`.
9. Click **Generate SQL**. LaunchDarkly returns a setup script that creates the warehouse, database, role, schema, and user with the names you chose.
10. Copy the generated script and, in Snowflake, paste it into a worksheet.
11. Run the worksheet in Snowflake. This creates the necessary Snowflake resources.
12. After reading the Integration Terms and Conditions, select the **I have read and agree to the Integration Terms and Conditions** checkbox.
13. In LaunchDarkly, click **Test connection and save**. LaunchDarkly tests the Snowflake connection and, if it succeeds, creates and activates the destination.

> [!NOTE]
>
> **Run the most recent setup script**
>
> If you change any field other than **Name** or the **Integration Terms and Conditions** checkbox after you generate the script, LaunchDarkly clears the script. Click **Generate SQL** again and run the new script in Snowflake before you click **Test connection and save**.
>
> Each time you click **Generate SQL**, LaunchDarkly creates a new key pair for the Snowflake user. Always run the most recently generated script. The Snowflake user must have the current public key.

Your Snowflake Data Export integration is now complete. If you plan to use Snowflake native Experimentation, the next step is to [set up the Snowflake native Experimentation integration](https://launchdarkly.com/docs/home/warehouse-native/snowflake-configure.md).

Snowflake Data Export runs an hourly job, on the hour, that publishes raw LaunchDarkly data in your Snowflake account. You can expect the new data to be available in your Snowflake account within 10-15 minutes after the hour.

To review the different event kinds for Snowflake Data Export destinations, read [Warehouse Data Export schema reference](https://launchdarkly.com/docs/integrations/data-export/warehouse-schema-reference.md).

> [!NOTE]
>
> **Enable Data Export for flags and environments**
>
> After you create the destination, you must enable Data Export for individual flags, or for all the flags in an environment. Otherwise, LaunchDarkly does not export flag event data to Snowflake. To learn more, read [Export event data for flags and environments](https://launchdarkly.com/docs/integrations/data-export#export-event-data-for-flags-and-environments).

## About the setup script

The setup script that LaunchDarkly generates uses the names you chose in LaunchDarkly, and its core steps run as the `SYSADMIN` and `SECURITYADMIN` roles. The script creates each object only if it does not already exist, which means you can run it more than once.

The script does the following:

* Creates an `XSMALL` standard warehouse that suspends after 60 seconds of inactivity and resumes automatically.
* Creates the database and the role, and grants the role to `SYSADMIN`. This does not give the role the privileges of `SYSADMIN`.
* Grants the role `USAGE` on the warehouse, `MONITOR` and `USAGE` on the database, and `USAGE` and `CREATE TABLE` on the schema it creates.
* Creates a Snowflake user with `TYPE = SERVICE`, sets its default role and warehouse, grants it the role, and sets its public key. LaunchDarkly connects with key-pair authentication, which means the user has no password.

If you turn on **Allowlist the LaunchDarkly IP**, the script also switches to the `ACCOUNTADMIN` role to create or update a network rule named `LD_DATA_EXPORT_NETWORK_RULE` in the export schema, and a network policy named `LD_DATA_EXPORT_NETWORK_POLICY`. If the rule already exists, the script keeps its existing IP addresses and adds the LaunchDarkly IP address. The script then assigns the policy to the LaunchDarkly member only. It does not change your account-level network policy.

## View an existing destination

The destination setup is visible on the edit page, which lets you confirm which account URL, database, warehouse, schema, role, and user a destination uses. However, all connection fields on the edit page are read-only. The project and environment you chose in the initial configuration are permanent and cannot be changed.

To view an existing Snowflake Data Export destination:

1. Click the **gear** icon in the left sidebar to view Organization settings.
2. Click **Integrations** and find "Snowflake Data Export."
3. Find the destination you want to view and click **Edit**. The Snowflake Data Export configuration page appears with the destination's settings.

The side panel shows the destination's **Connection status**, when it was created, and its **Last successful export**.

On the edit page, you can change only the following:

* **Name**: Click the **Edit name** icon next to the **Name** field, enter a new name, and click the **Save name** icon.
* **Maintainer**: Choose a new maintainer in the side panel. You must have a role that lets you edit the destination.

To change any other value, delete the destination and configure a new one.

## Delete a destination

Deleting a destination stops LaunchDarkly from exporting data to Snowflake for that environment.

To delete a Snowflake Data Export destination:

1. Open the destination's edit page, as described in [View an existing destination](#view-an-existing-destination).
2. Click the **Delete integration** icon. A confirmation dialog appears.
3. Type `DELETE` and click **Delete**.

## Health checks

If your warehouse Data Export integration develops connection problems or other errors, the integration will display a health check warning. To learn more, read [Warehouse health checks](https://launchdarkly.com/docs/home/warehouse-native/warehouse-health-checks.md).
