Skip to main content
This tutorial helps you configure Confidence to talk to Snowflake to store assignment data and calculate metrics. The steps to take are the following:
  1. Create a Snowflake user and role that Confidence can use to read and write data to your warehouse.
  2. Grant the role permissions to use a Snowflake warehouse.
  3. Set up a schema and/or a database to store assignment data coming out of Confidence Flags.
  4. Set up a schema and/or a database to store exposure calculation data.
  5. Generate a key pair in confidence, and assign the public key to your Snowflake user.
  6. Configure a Data Warehouse connection so that Confidence can compute metrics using Snowflake.
  7. Configure a Flag Applied connector so that Confidence can store assignment data in Snowflake.
If you already followed the setup guide on the Admin page, your setup is already complete. You can skip directly to what’s next.

Before You Begin

  • This tutorial assumes you have a Confidence account.
  • This tutorial assumes you have a Snowflake account ready, and have the permissions needed to create users, roles, databases and schemas for that account. You should also have a Snowflake warehouse available to run Confidence queries.

Step 1. Create a Snowflake User and/or Role

As a first step, you create a Snowflake user, and grant a role to that user. You can either use a pre-existing role that you already have, or create a new role just for the Confidence integration.
CREATE ROLE CONFIDENCE_ROLE;
CREATE USER CONFIDENCE DEFAULT_ROLE = CONFIDENCE_ROLE;
GRANT ROLE CONFIDENCE_ROLE TO USER CONFIDENCE;

Step 2. Give the Role Permissions to Run Queries in a Warehouse

Confidence needs to run queries to calculate metrics, so for this you need to grant the role you created permissions to use the warehouse. You can either create a new warehouse only for Confidence, or use an existing warehouse.
GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE CONFIDENCE_ROLE;

Step 3. Create Database and Schemas for Assignment Data

Confidence needs two schemas in Snowflake: one to store assignment data and one to store internal data for the exposure calculations. In the following example, you create a separate database to hold Confidence data. To create the schemas, follow these steps (or change according to your organization guidelines):
CREATE DATABASE CONFIDENCE;
GRANT USAGE ON DATABASE CONFIDENCE TO ROLE CONFIDENCE_ROLE;
CREATE SCHEMA CONFIDENCE.FLAG_APPLIED;
GRANT USAGE ON SCHEMA CONFIDENCE.FLAG_APPLIED TO ROLE CONFIDENCE_ROLE;
GRANT CREATE TABLE ON SCHEMA CONFIDENCE.FLAG_APPLIED TO ROLE CONFIDENCE_ROLE;
GRANT ALL ON ALL TABLES IN SCHEMA CONFIDENCE.FLAG_APPLIED TO ROLE CONFIDENCE_ROLE;
GRANT ALL ON FUTURE TABLES IN SCHEMA CONFIDENCE.FLAG_APPLIED TO ROLE CONFIDENCE_ROLE;
The role also needs read-only access to any tables you want to use to define metrics (the tables you use to define fact table queries).

Step 4. Create Schemas for Exposure Calculations

Repeat the preceding steps to create a second schema. For example, EXPOSURE.

Step 5. Generate a Key in Confidence, and Assign the Public Key to Your Snowflake User

  1. Go to the Confidence App.
  2. On the bottom of the left sidebar, select Admin > Connections > Metrics Data Warehouse.
  3. Select Snowflake.
  4. Click on the “Crypto key” combo box, and generate a new key that you can call whatever you want. Then click the “Copy public key” button to the right of the combo box to copy the public key to your clipboard.
  5. Run the following SQL command in Snowflake to let Confidence authenticate as the user you created using the public key:
    ALTER USER <username> SET rsa_public_key='<paste key here>';
    
You are now ready to configure the rest of the settings on the warehouse connection.

Step 6. Configure a Metrics Data Warehouse

For Confidence to be able to compute metrics using Snowflake, you need to set up the connection between Confidence and Snowflake. To do so, follow these steps:
  1. Go to the Confidence App.
  2. On the bottom of the left sidebar, select Admin > Connections > Metrics Data Warehouse.
  3. Select Snowflake.
  4. Select the Crypto key you created in the earlier step, and complete the rest of the configuration form. After configuring the account identifier, user, and the crypto key, Confidence reads the available roles, databases and schemas from Snowflake and populates the remaining options.
  5. Click SAVE.
If you have mis-configured anything, you see an error message. Otherwise, you should see a success message.

Step 7. Configure a Flag Applied Connector

For Confidence to be able to store assignment data in Snowflake, you need to set up the connection between Confidence and Snowflake. To do so, follow these steps:
  1. Go to the Confidence App.
  2. On the bottom of the left sidebar, select Admin > Connections > Flag Applied.
  3. Click Create
  4. Select Snowflake as destination.
  5. Select the Crypto key you created in the earlier step, and complete the rest of the configuration form. After configuring the account identifier, user, and the crypto key, Confidence reads the available roles, databases and schemas from Snowflake and populate the remaining options.
  6. Click Save.

Step 8. Configure an Assignment Table

For Confidence to be able to use the stored assignment table, you need to set up an assignment that reads from the Snowflake table. You first need to create an entity, which represents the thing you’re experimenting on, like your users. To do so, follow these steps:
1

Go to Confidence

2

Navigate to Entities

On the left sidebar, select Admin > Entities.
3

Click Create

4

Create the entity

Enter User and specify the data type of the identifier that identifies the entity. For example, if you have a UUID that identifies your users, your primary key type is a String.
Now that you have an entity, you can create an assignment table that reads from the Snowflake table. To do so, follow these steps:
1

Go to the Confidence App

2

Navigate to the Snowflake connection

On the bottom of the left sidebar, select Admin > Connections > Flag Applied and select the Snowflake connection you created.
3

Click Create in the Assignment table section

4

Select the entity you created in the earlier step

5

Enter a name for the assignment table

Enter a name for the assignment table, such as flag_applied.
6

Click Create

Step 9. Celebrate

That’s it! You have now configured Confidence to store assignment data and compute metrics using Snowflake. You can now start defining metrics and compute results.

What’s Next?

The next step is to create a fact table, and a metric. For an overview, see the metric introduction page, and the metrics quickstart.