> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/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.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

<Note title="Data Export is an add-on feature">
  Data Export is available as an add-on 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/).
</Note>

## Overview

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 [Snowflake native Experimentation](/home/warehouse-native/snowflake).

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 `SECURITYADMIN` and `SYSADMIN` roles in Snowflake
* You must have a [LaunchDarkly role](/home/account/roles) that allows you to [add and edit integrations](/home/account/roles/role-actions#integration-actions) and [add destinations](/home/account/roles/role-actions#destination-actions)

<Feature flag="docs-enable-non-commercial-content" fallbackValue={"commercial"} match={"commercial"}>\* You need to allow LaunchDarkly's data transfer service’s static IP address: `35.192.85.117`</Feature>

<Feature flag="docs-enable-non-commercial-content" fallbackValue={"commercial"} match={"eu"}>\* You need to allow LaunchDarkly's data transfer service’s static IP address: `35.241.154.37`</Feature>

* 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**:

<Frame caption="The &#x22;Copy account URL&#x22; option in Snowflake.">
  ![The "Copy account URL" option in Snowflake.](https://files.buildwithfern.com/https://launchdarkly.docs.buildwithfern.com/docs/f733aef43ec4af715c6b16f9afb33a16b40694442b55605f4507afebfa09b742/assets/images/__third_party/snowflake-copy-account-url.png)
</Frame>

* If you use network policies within your Snowflake account, you will need to create or update your policy to allow traffic from LaunchDarkly. To do this, you need your LaunchDarkly project key and environment key:

1. Find, copy, and save your project key [following these instructions](/home/account/project#project-keys).

2. Find, copy, and save your environment key [following these instructions](/home/account/environment/keys#environment-keys).

3. Combine the keys together, separated by two underscores. For example, if your project key is `MobileApp` and your environment key is `production`, your combined key will be `MobileApp__production`.

4. Replace `<ProjKey__EnvKey>` with your combined key in the code sample below, and add it to your Snowflake network policy:

<Feature flag="docs-enable-non-commercial-content" fallbackValue={"commercial"} match={"commercial"}>
  <CodeGroup>
    ```sql title="Snowflake network policy" theme={null}
          CREATE NETWORK RULE LD_EXPORT.EXPORT_<ProjKey__EnvKey>.LD_DATA_EXPORT_NETWORK_RULE TYPE = IPV4 MODE = INGRESS VALUE_LIST = ('35.192.85.117');

          CREATE NETWORK POLICY LD_DATA_EXPORT_NETWORK_POLICY
            ALLOWED_NETWORK_RULE_LIST=(LD_DATA_EXPORT_NETWORK_RULE);

          ALTER USER LD_EXPORT_USER_<ProjKey__EnvKey> SET NETWORK_POLICY = LD_DATA_EXPORT_NETWORK_POLICY;
    ```
  </CodeGroup>
</Feature>

<Feature flag="docs-enable-non-commercial-content" fallbackValue={"commercial"} match={"eu"}>
  <CodeGroup>
    ```sql title="Snowflake network policy" theme={null}
          CREATE NETWORK RULE LD_EXPORT.EXPORT_<ProjKey__EnvKey>.LD_DATA_EXPORT_NETWORK_RULE TYPE = IPV4 MODE = INGRESS VALUE_LIST = ('35.241.154.37');

          CREATE NETWORK POLICY LD_DATA_EXPORT_NETWORK_POLICY
            ALLOWED_NETWORK_RULE_LIST=(LD_DATA_EXPORT_NETWORK_RULE);

          ALTER USER LD_EXPORT_USER_<ProjKey__EnvKey> SET NETWORK_POLICY = LD_DATA_EXPORT_NETWORK_POLICY;
    ```
  </CodeGroup>
</Feature>

## Prepare your Snowflake instance

You must prepare a separate Snowflake user and schema for each LaunchDarkly project/environment you want to set up for export. The database, warehouse, and role are shared among environments.

First, in Snowflake, create a warehouse and database. You can skip this step if you have already created the warehouse and database below, and are only setting up an additional project/environment.

<CodeGroup>
  ```sql title="Snowflake warehouse and database" theme={null}
      begin;

          -- These variables should not be changed
          set warehouse_name = 'LD_EXPORT_WH'; -- all letters must be uppercase
          set database_name = 'LD_EXPORT'; -- all letters must be uppercase

          use role sysadmin;

          -- Create a warehouse for data transfer service
          create warehouse if not exists identifier($warehouse_name)
          warehouse_size = xsmall
          warehouse_type = standard
          auto_suspend = 60
          auto_resume = true
          initially_suspended = true;

          -- Create database for data transfer service
          create database if not exists identifier($database_name);

      commit;
  ```
</CodeGroup>

Next, create a role with the required privileges on the database and warehouse. You will create a single role for all environments:

<CodeGroup>
  ```sql title="Snowflake role" theme={null}
      begin;

          -- These variables should not be changed
          set role_name = 'LD_EXPORT_ROLE'; -- all letters must be uppercase
          set warehouse_name = 'LD_EXPORT_WH'; -- all letters must be uppercase
          set database_name = 'LD_EXPORT'; -- all letters must be uppercase

          -- Change role to securityadmin for role steps
          use role securityadmin;

          -- Create role for data transfer service
          create role if not exists identifier($role_name);

          -- Establish SYSADMIN as the parent of the new role. Note: this does not grant the access privileges of SYSADMIN to the new role.
          grant role identifier($role_name) to role SYSADMIN;

          -- Change role to sysadmin for warehouse / database steps
          use role sysadmin;

          -- Grant service role access to warehouse
          grant usage
          on warehouse identifier($warehouse_name)
          to role identifier($role_name);

          -- Grant service role access to database
          grant monitor, usage
          on database identifier($database_name)
          to role identifier($role_name);

      commit;
  ```
</CodeGroup>

## Connect your Launch

Darkly environment to SnowflakeIn this section, you are working in LaunchDarkly and Snowflake simultaneously. We recommend having two browser windows or tabs open to easily switch back and forth between the two applications.

Begin by configuring the Snowflake Data Export integration in LaunchDarkly:

1. In LaunchDarkly, click the **gear** icon in the left sidenav to view Organization settings.

2. Click **Integrations** and find "Snowflake Data Export."

3. Click **Add integration**. The \["Create a destination" panel]\([https://app.launchdarkly.com/settings/integrations/destinations/new?kind=snowflake-v](https://app.launchdarkly.com/settings/integrations/destinations/new?kind=snowflake-v)

4. appears.

5. (Optional) Give your integration a human-readable **Name**.

6. Choose a **Project and environment** to export data from.

7. Enter your **Snowflake account URL**. A Snowflake SQL script appears.

8. Copy the provided Snowflake SQL script and, in Snowflake, paste it into a worksheet.

9. In Snowflake, run the Snowflake worksheet. This creates the necessary Snowflake resources.

10. In LaunchDarkly, test the integration by clicking **Test connection**.

11. After reading the Integration Terms and Conditions, check the **I have read and agree to the Integration Terms and Conditions** checkbox.

12. Click **Save destination**. The new Snowflake destination appears in the list of destinations.

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](/home/warehouse-native/snowflake-configure).

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 view the different event kinds for Snowflake Data Export destinations, read [Warehouse Data Export schema reference](/integrations/data-export/warehouse-schema-reference).

## 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](/home/warehouse-native/warehouse-health-checks).
