-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Lukas.goetzweiss/experiments snowflake guide #35422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lukasgoetzweiss
wants to merge
22
commits into
master
Choose a base branch
from
lukas.goetzweiss/experiments_snowflake_guide
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+146
−0
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c0299fb
snowflake experiments guide ready for review
b72adba
rm duplicate image, add consistency in product name
cde519b
Edited the content in step 1
iadjivon 18b5efa
quick change
iadjivon a4ce662
modified step 2 content.
iadjivon efe07b0
Fix grammar, alt texts, and add SME verification note
iadjivon 4ab7d6a
edits
iadjivon 351d111
added step 3 and reviewed the content
iadjivon c5702dc
added review changes from /review
iadjivon a31252e
small changes
iadjivon 3ab2b8f
additional changes
iadjivon 3ee126f
improve Overview section of Snowflake connection guide
iadjivon 93d58b4
make overview intro warehouse-agnostic
iadjivon 5c69173
refine Step 1 content and callouts for clarity
iadjivon a53a2a3
add note about manually entering database and schema in Step 3
iadjivon f611ec9
updated table read permission code, moved unencrypted key out of callout
53922de
tighten warehouse paragraph in Step 2
iadjivon 3da4e44
Merge remote-tracking branch 'origin/lukas.goetzweiss/experiments_sno…
iadjivon 10d6055
clarify that only one GRANT SELECT option is needed in Step 2
iadjivon f5ab8ea
simplify GRANT SELECT instruction in Step 1
iadjivon fd8e567
fix comma splice and clarify multiple GRANT SELECT options
iadjivon cf3dabe
quick changes
iadjivon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| title: Experiments Guides | ||
| private: true | ||
| disable_toc: true | ||
| cascade: | ||
| algolia: | ||
| rank: 20 | ||
| category: Guide | ||
| subcategory: Experiment Guides | ||
| --- | ||
|
|
||
| {{< whatsnext desc="Connect warehouse data to Datadog Experiments:" >}} | ||
| {{< nextlink href="experiments/guide/connecting_snowflake" >}}Connect Snowflake Data to Datadog Experiments | ||
| {{< /nextlink >}} | ||
|
|
||
| {{< /whatsnext >}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| --- | ||
| title: Connect Snowflake for Warehouse-Native Experiment Analysis | ||
| description: Connect a Snowflake service account to enable warehouse-native experiment analysis. | ||
| further_reading: | ||
| - link: "/experiments/defining_metrics" | ||
| tag: "Documentation" | ||
| text: "Defining metrics in Datadog Experiments" | ||
| - link: "https://www.datadoghq.com/blog/experimental-data-datadog/" | ||
| tag: "Blog" | ||
| text: "How to bridge speed and quality in experiments through unified data" | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| Warehouse-native experiment analysis lets you run statistical computations directly in your data warehouse. | ||
|
|
||
| To set this up for Snowflake, connect a Snowflake service account to Datadog and configure your experiment settings. This guide covers: | ||
|
|
||
| - [Preparing a Snowflake service account](#step-1-prepare-the-snowflake-service-account) | ||
| - [Connecting it to Datadog](#step-2-connect-snowflake-to-datadog) | ||
| - [Configuring experiment settings](#step-3-configure-experiment-settings) | ||
|
|
||
| ## Step 1: Prepare the Snowflake service account | ||
|
|
||
| The examples in this guide use `datadog_experiments_user` and `datadog_experiments_role` as the service account's user and role. Replace these with your own values. | ||
|
|
||
| ### Create a dedicated service user and role in Snowflake | ||
|
|
||
| 1. Use the [Snowflake documentation][1] to create a public-private key pair for enhanced authentication. Datadog only supports unencrypted private keys. | ||
| 1. Run the following commands in Snowflake to create the user and role in the service account. Replace `<public_key>` with the public key you generated in the previous step. | ||
|
|
||
| ```sql | ||
| USE ROLE ACCOUNTADMIN; | ||
| CREATE ROLE IF NOT EXISTS datadog_experiments_role; | ||
| CREATE USER IF NOT EXISTS datadog_experiments_user | ||
| RSA_PUBLIC_KEY = '<public_key>'; | ||
| GRANT ROLE datadog_experiments_role TO USER datadog_experiments_user; | ||
| ALTER USER datadog_experiments_user SET DEFAULT_ROLE = datadog_experiments_role; | ||
| ``` | ||
|
|
||
| ### Grant privileges to the role | ||
|
|
||
| 1. Identify the tables in Snowflake from which you intend to create metrics. | ||
| 1. Run the following commands to grant read privileges to the new role, replacing `<database>`, `<schema>`, and `<table>` with their appropriate values. Run both `GRANT USAGE` commands, then run the `GRANT SELECT` option or options that match your access needs. | ||
|
|
||
| ```sql | ||
| GRANT USAGE ON DATABASE <database> TO ROLE datadog_experiments_role; | ||
| GRANT USAGE ON SCHEMA <database>.<schema> TO ROLE datadog_experiments_role; | ||
|
|
||
| -- Option 1: Give read access to a single table | ||
| GRANT SELECT ON TABLE <database>.<schema>.<table> TO ROLE datadog_experiments_role; | ||
|
|
||
| -- Option 2: Give read access to all existing tables in the schema | ||
| GRANT SELECT ON ALL TABLES IN SCHEMA <database>.<schema> TO ROLE datadog_experiments_role; | ||
|
|
||
| -- Option 3: Give read access to all future tables in the schema | ||
| GRANT SELECT ON FUTURE TABLES IN SCHEMA <database>.<schema> TO ROLE datadog_experiments_role; | ||
| ``` | ||
|
|
||
| ### Grant the role access to the output schema | ||
|
|
||
| Datadog writes experiment exposure logs and intermediate metric results to tables in a dedicated output schema. Run the following commands to create the schema and grant the role full access. Replace `<database>` with the appropriate value. | ||
|
|
||
| ```sql | ||
| CREATE SCHEMA IF NOT EXISTS <database>.datadog_experiments_output; | ||
| GRANT ALL ON SCHEMA <database>.datadog_experiments_output TO ROLE datadog_experiments_role; | ||
| GRANT ALL PRIVILEGES ON FUTURE TABLES IN SCHEMA <database>.datadog_experiments_output TO ROLE datadog_experiments_role; | ||
| ``` | ||
|
|
||
| ### Create a dedicated warehouse for Datadog Experiments (optional) | ||
|
|
||
| <div class="alert alert-info">The <a href="#create-a-dedicated-service-user-and-role-in-snowflake">role you created</a> must have access to at least one warehouse to compute results. You must enter the warehouse name when configuring experiment settings in <a href="#step-3-configure-experiment-settings">Step 3</a>.</div> | ||
|
|
||
| Creating a dedicated warehouse for Datadog Experiments is optional. Run the following commands to create one. Replace `<wh_size>` with the appropriate value. | ||
|
|
||
| ```sql | ||
| CREATE WAREHOUSE IF NOT EXISTS datadog_experiments_wh | ||
| WAREHOUSE_SIZE = <wh_size> | ||
| AUTO_SUSPEND = 300 | ||
| INITIALLY_SUSPENDED = true; | ||
| GRANT ALL PRIVILEGES ON WAREHOUSE datadog_experiments_wh TO ROLE datadog_experiments_role; | ||
| ``` | ||
|
|
||
| ## Step 2: Connect Snowflake to Datadog | ||
|
|
||
| To connect your Snowflake account to Datadog for warehouse-native experiment analysis: | ||
|
|
||
| 1. Navigate to [Datadog's integrations page][2] and search for **Snowflake**. | ||
| 1. Click the **Snowflake** tile to open its modal. | ||
| 1. Select the **Configure** tab and click **Add Snowflake Account**. | ||
| 1. Add your **Account URL**. To find your account URL, see the [Snowflake guide][3]. | ||
| 1. Toggle off all resources (these are not needed for experiment analysis). | ||
| 1. Enter the Snowflake **User Name** you created in [Step 1](#step-1-prepare-the-snowflake-service-account) (for example, `datadog_experiments_user`). | ||
| 1. Scroll to the **Configure a key pair authentication** section and upload your unencrypted **private key**. | ||
| 1. Click **Save**. | ||
|
|
||
| <div class="alert alert-info">The grants in the <strong>Recommended Warehouse Settings</strong> section of the Snowflake integration tile are not needed for warehouse-native experiment analysis. The privileges granted in <a href="#grant-privileges-to-the-role">Step 1</a> are sufficient. | ||
| <br><br> If you plan to use other warehouse observability functionality in Datadog, see <a href="https://docs.datadoghq.com/integrations/snowflake-web/">Datadog's Snowflake integration documentation</a> to determine which resources to enable.</div> | ||
|
|
||
| {{< img src="/product_analytics/experiment/guide/snowflake_main_integration.png" alt="The Snowflake integration tile in Datadog showing the Configure tab with the Add a new Snowflake account form, including an Account URL field and resource toggles for Metrics and Logs." style="width:90%;" >}} | ||
|
|
||
| ## Step 3: Configure experiment settings | ||
|
|
||
| After you set up your Snowflake integration, configure the experiment settings in [Datadog Product Analytics][4]: | ||
|
|
||
| 1. In the left navigation, hover over **Settings**, then click **Experiments**. | ||
| 1. Select the **Warehouse Connections** tab. | ||
| 1. Click **Connect a data warehouse**. If you already have a warehouse connected, click **Edit** instead. | ||
| 1. Select the **Snowflake** tile. | ||
| 1. Enter the **Account**, **Role**, **Warehouse**, **Database**, and **Schema** you configured in [Step 1](#step-1-prepare-the-snowflake-service-account). If your database and schema do not appear in the dropdown, enter them manually to add them to the list. | ||
| 1. Click **Save**. | ||
|
|
||
| {{< img src="/product_analytics/experiment/guide/snowflake_experiment_setup.png" alt="The Edit Data Warehouse modal with Snowflake selected, showing two sections: Select Snowflake Account with fields for Account, Role, and Warehouse, and Select Database and Schema with fields for Database and Schema." style="width:90%;" >}} | ||
|
|
||
| After you save your warehouse connection, create experiment metrics using your Snowflake data. See [Create Experiment Metrics][5]. | ||
|
|
||
| ## Further reading | ||
|
|
||
| {{< partial name="whats-next/whats-next.html" >}} | ||
|
|
||
| [1]: https://docs.snowflake.com/en/user-guide/key-pair-auth | ||
| [2]: https://app.datadoghq.com/integrations | ||
| [3]: https://docs.snowflake.com/en/user-guide/organizations-connect | ||
| [4]: https://app.datadoghq.com/product-analytics | ||
| [5]: /experiments/defining_metrics | ||
Binary file added
BIN
+72.6 KB
static/images/product_analytics/experiment/guide/snowflake_experiment_setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+148 KB
static/images/product_analytics/experiment/guide/snowflake_main_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.