No results for ""
EXPAND ALL
  • Home
  • API docs

Snowflake

Read time: 3 minutes
Last edited: Nov 14, 2024
This feature is for Early Access Program customers only

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 and sysadmin 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 liking
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;

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 liking
set role_name = 'LD_EXPORT_ROLE'; -- all letters must be uppercase
-- If using your own existing warehouse and database, set these accordingly
set warehouse_name = 'LD_EXPORT_WH';
set database_name = 'LD_EXPORT';
-- 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;

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 liking
set ld_env_name = '<YOUR_LD_ENV>'; -- name of your Launchdarkly project/environment
set schema_name = CONCAT('LD_EXPORT_', $ld_env_name); -- this schema name will be provided to Launchdarkly
set 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 earlier
set warehouse_name = 'LD_EXPORT_WH';
set database_name = 'LD_EXPORT';
set role_name = 'LD_EXPORT_ROLE';
-- Change role to sysadmin for schema steps
use role sysadmin;
-- Create schema for the environment
use database identifier($database_name);
create schema if not exists identifier($schema_name);
-- Grant service role access to the schema
grant USAGE, CREATE TABLE
on schema identifier($schema_name)
to role identifier($role_name);
-- Change role to securityadmin for user steps
use role securityadmin;
-- Create a user for data transfer service
create user if not exists identifier($user_name);
-- Set default role and warehouse to new user
alter 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.