Snowflake
Read time: 3 minutes
Last edited: Nov 14, 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 begin the set up process to create a Snowflake destination for Data Export. After you have joined the EAP, your LaunchDarkly account representative will help you complete the process.
Prerequisites
To configure the Snowflake integration, you must have the following prerequisites:
- You or your Snowflake admin must have the
securityadmin
andsysadmin
roles in Snowflake. - You may need to allow LaunchDarkly's data transfer service’s static IP address:
35.192.85.117
.
Prepare your Snowflake instance
Part of the process to set up the Snowflake integration involves preparing your Snowflake instance so that Launchdarkly can securely access it. To begin, prepare a separate Snowflake user and schema for each Launchdarkly environment you want to set up for export. The database, warehouse, and role can be shared among environments.
First, in Snowflake create a warehouse and database. This step is optional if you already have an existing warehouse or database you want to use. Note that if you decide to share a warehouse among multiple environments, query concurrency limitations of the warehouse may cause transfer delays.
begin;-- These variables can be changed to your likingset warehouse_name = 'LD_EXPORT_WH'; -- all letters must be uppercaseset database_name = 'LD_EXPORT'; -- all letters must be uppercaseuse role sysadmin;-- Create a warehouse for data transfer servicecreate warehouse if not exists identifier($warehouse_name)warehouse_size = xsmallwarehouse_type = standardauto_suspend = 60auto_resume = trueinitially_suspended = true;-- Create database for data transfer servicecreate database if not exists identifier($database_name);commit;
Create a role with the required privileges on the database and warehouse. You can create a single role for all environments, or create a separate role for each environment.
begin;-- This variable can be changed to your likingset role_name = 'LD_EXPORT_ROLE'; -- all letters must be uppercase-- If using your own existing warehouse and database, set these accordinglyset warehouse_name = 'LD_EXPORT_WH';set database_name = 'LD_EXPORT';-- Change role to securityadmin for role stepsuse role securityadmin;-- Create role for data transfer servicecreate 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 stepsuse role sysadmin;-- Grant service role access to warehousegrant USAGEon warehouse identifier($warehouse_name)to role identifier($role_name);-- Grant service role access to databasegrant MONITOR, USAGEon database identifier($database_name)to role identifier($role_name);commit;
Create a Snowflake schema and user for each Launchdarkly project and environment you want to set up:
begin;-- These variables can be changed to your likingset ld_env_name = '<YOUR_LD_ENV>'; -- name of your Launchdarkly project/environmentset schema_name = CONCAT('LD_EXPORT_', $ld_env_name); -- this schema name will be provided to Launchdarklyset user_name = CONCAT('LD_EXPORT_USER_', $ld_env_name); -- this user name will be provided to Launchdarkly-- Ensure these match with the warehouse, database, and role names you created earlierset warehouse_name = 'LD_EXPORT_WH';set database_name = 'LD_EXPORT';set role_name = 'LD_EXPORT_ROLE';-- Change role to sysadmin for schema stepsuse role sysadmin;-- Create schema for the environmentuse database identifier($database_name);create schema if not exists identifier($schema_name);-- Grant service role access to the schemagrant USAGE, CREATE TABLEon schema identifier($schema_name)to role identifier($role_name);-- Change role to securityadmin for user stepsuse role securityadmin;-- Create a user for data transfer servicecreate user if not exists identifier($user_name);-- Set default role and warehouse to new useralter user identifier($user_name) SET default_role = $role_name;alter user identifier($user_name) SET default_warehouse = $warehouse_name;grant role identifier($role_name) to user identifier($user_name);commit;
After your Snowflake instance preparation is complete, contact your LaunchDarkly representative for next steps. They will guide you through the rest of the setup process.