Snowflake
Read time: 3 minutes
Last edited: Oct 16, 2024
The Snowflake integration is only available to members of LaunchDarkly's Early Access Program (EAP). If you want access to this feature, join the EAP.
Overview
This topic explains how to create and test a Snowflake destination for Data Export.
To use the Snowflake integration, your Snowflake instance must be in the AWS us-east-1 region.
Snowflake Data Export only exports flag evaluation events for flags used in experiments. To learn more, read Experimentation.
Prerequisites
To configure the Snowflake integration, you must have the following prerequisites:
- Your Snowflake instance must be in the AWS us-east-1 region.
- You must have the Account Locator for your Snowflake account. You can use the
current_account()
helper to find this. To learn how, read Snowflake's documentation.
Create a Snowflake destination in LaunchDarkly
To create the Snowflake destination:
- Navigate to the Integrations page and find "Snowflake."
- Click Add integration. The "Create a destination" panel appears.
- (Optional) Give your integration a human-readable Name.
- Choose an Environment for this integration to apply to.
- Enter the Snowflake Account Locator.
- Click Save destination. The new integration appears in the list of integrations.
Test a Snowflake destination
After you save the destination, send a test event to confirm that the destination is configured properly.
To send a test event:
- Navigate to the Integrations page and find "Snowflake."
- Click into the "Snowflake" section to display a list of destinations.
- Click the pencil icon next to the destination you want to test. The "Edit destination" panel appears.
- In the "Send a test event" section, click Send event.
- Verify the event appears in Snowflake.
Consume shared data in Snowflake
After you have created your destination, LaunchDarkly adds you to a secure share for you to consume your events.
Create a database in your Snowflake account to query the shared data. You can create the database using the user interface (UI) or a Snowflake worksheet.
Snowflake worksheet
Open a worksheet using an account that has access to the accountadmin
role in Snowflake. Use the code below to create a database from the share.
Run each command individually in order to verify access to the share.
Replace <database_name>
with your chosen values:
use role accountadmin;show shares;desc share IDMXGKA.LD_DATA_EXPORT.SHARED_EVALUATIONS;create database <database_name> from share IDMXGKA.LD_DATA_EXPORT.SHARED_EVALUATIONS;
Use the following sample to grant SELECT
permissions to any of your custom roles that require them.
Replace <database_name>
and <role_name>
with your chosen values:
grant imported privileges on database <database_name> to <role_name>;
Example events
These example events display the structure of the data LaunchDarkly sends to Snowflake. Each row in the exported data represents an (event, context) tuple. If you're using multi-contexts, there will be one row for each context within your multi-context for each event.
LaunchDarkly sends events in the following format:
ID,PROJECTID,ENVIRONMENTID,CONTEXTKIND,CONTEXTKEY,VARIATIONINDEX,VARIATIONVALUE,VARIATIONNAME,FLAGKEY,TIMESTAMP,SNOWFLAKEACCOUNTID642aa35a545fbb000e123456,5866f3891cd8810a42123456,586c33cf1cd88133f9123456,user,5efa6ca891e30321f0123456,1,false,,enable-confluence-smart-links,2023-04-03 09:58:47.000,ld00123
Enable Data Export for flags and environments
After you create a Data Export destination, you must start sending flag or environment event data to it. You can enable Data Export for individual flags, or for all the flags in an environment.
To learn more, read Export event data for flags and environments.
Delete a Snowflake destination
You can delete a Data Export destination from the Integrations screen.
To delete a destination:
- Navigate to the Integrations page and find "Snowflake."
- Click into the "Snowflake" section to display a list of destinations.
- Click the pencil icon next to the destination you wish to delete. The "Edit destination" panel appears.
- Click Delete destination.