For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/experiments/guide/connecting_a_data_warehouse.md. A documentation index is available at /llms.txt.

Connect your Data Warehouse for Warehouse-Native Experiment Analysis

This product is not supported for your selected Datadog site. ().

Data warehouse


Overview

Warehouse-native experiment analysis lets you run statistical computations directly in your data warehouse.

To set this up for BigQuery, connect a BigQuery service account to Datadog and configure your experiment settings. This guide covers:

Prerequisites

Datadog connects to BigQuery through a Google Cloud service account. If you already have a service account connected to Datadog, skip to Step 1. Otherwise, expand the section below to create one.

  1. Open your Google Cloud console.
  2. Navigate to IAM & Admin > Service Accounts.
  3. Click Create service account.
  4. Enter the following:
    1. Service account name.
    2. Service account ID.
    3. Service account description.
  5. Click Create and continue.
    1. Note: The Permissions and Principals with access settings are optional here. These are configured in Step 2.
  6. Click Done.

After you create the service account, continue to Step 1 to set up the Google Cloud resources.

If you plan to use other Google Cloud observability functionality in Datadog, see Datadog's Google Cloud Platform integration documentation to determine which resources to enable.

Step 1: Prepare the Google Cloud resources

Datadog Experiments uses a BigQuery dataset for caching experiment results and a Cloud Storage bucket for staging experiment records.

Create a BigQuery dataset

  1. Open your Google Cloud console.
  2. In the Search bar, search for BigQuery.
  3. In the Explorer panel, expand your project (for example, datadog-sandbox).
  4. Select Datasets, then click Create dataset.
    The BigQuery Datasets page in the Google Cloud console showing the datadog-sandbox project expanded in the left Explorer menu with Datasets selected, a list of datasets with columns for Dataset ID, Type, Location, Create time, and Label, and the Create dataset button highlighted in the top right.
  5. Enter a Dataset ID (for example, datadog_experiments_output).
  6. (Optional) Select a Data location from the dropdown, add Tags, and set Advanced options.
  7. Click Create dataset.

Create a Cloud Storage bucket

Create a Cloud Storage bucket that Datadog Experiments can use to stage experiment exposure records. See Google's Create a bucket documentation.

Step 2: Grant permissions to the Datadog service account

The Datadog Experiments service account requires specific permissions to run warehouse-native experiment analysis.

Assign IAM roles at the project level

To assign IAM roles so Datadog Experiments can read and write data, and run jobs in your data warehouse:

  1. Open your Google Cloud console and navigate to IAM & Admin > IAM.
  2. Select the Allow tab and click Grant access.
  3. In the New principals field, enter the service account email.
  4. Using the Select a role dropdown, add the following roles:
    1. BigQuery Job User: Allows the service account to run BigQuery jobs.
    2. BigQuery Data Owner: Grants the service account full access to the Datadog Experiments output dataset.
    3. Storage Object User: Allows the service account to read and write objects in the storage bucket that Datadog Experiments uses.
    4. BigQuery Data Viewer: Allows the service account to read tables used in warehouse-native metrics.
  5. Click Save.
The Google Cloud IAM page showing the Grant access panel for a project, with the Grant access button highlighted on the left, a New principals field highlighted in the Add principals section, and a Select a role dropdown highlighted in the Assign roles section.

Grant read access to specific source tables

Repeat the following steps for each dataset you plan to use for experiment metrics:

  1. In the Google Cloud console Search bar, search for BigQuery.
  2. In the Explorer panel, expand your project (for example, datadog-sandbox).
  3. Click Datasets, then select the dataset containing your source tables.
  4. Click the Share dropdown and select Manage permissions.
    The BigQuery dataset page with the Share dropdown expanded and Manage permissions highlighted, showing additional options including Copy link, Authorize Views, Authorize Routines, Authorize Datasets, Manage Subscriptions, and Publish as Listing.
  5. Click Add principal.
  6. In the New principals field, enter the service account email.
  7. Using the Select a role dropdown, select the BigQuery Data Viewer role.
  8. Click Save.

To set this up for Databricks, connect a Databricks service account to Datadog and configure your experiment settings. This guide covers:

Prerequisites

Datadog Experiments connects to Databricks through the Datadog Databricks integration. If you already have a Databricks integration configured for the workspace you plan to use, skip to Step 1. Otherwise, expand the section below to create a service principal.

In your Databricks Workspace:

  1. Click your profile in the top right corner and select Settings.
  2. In the Settings menu, click Identity and access.
  3. On the Service principals row, click Manage, then:
    1. Click Add service principal, then Add new.
    2. Enter a service principal name and click Add.
  4. Click the name of the new service principal to open its details page.
  5. Select the Permissions tab, then:
    1. Click Grant access.
    2. Under User, Group or Service Principal, enter the service principal name.
    3. Using the Permission dropdown, select Manage.
    4. Click Save.
  6. Select the Secrets tab, then:
    1. Click Generate secret.
    2. Set the Lifetime (days) value to the maximum allowed (for example, 730).
    3. Click Generate.
    4. Note your Secret and Client ID.
    5. Click Done.
  7. In the Settings menu, click Identity and access.
  8. On the Groups row, click Manage, then:
    1. Click admins, then Add members.
    2. Enter the service principal name and click Add.

After you create the service principal, continue to Step 1 to grant the required permissions.

If you plan to use other warehouse observability functionality in Datadog, see Datadog's Databricks integration documentation to determine which resources to enable.

Step 1: Grant permissions to the service principal

You must be an account admin to grant these permissions.

In your Databricks Workspace, open the SQL Editor to run the following commands and grant the service principal permissions for warehouse-native experiment analysis.

The Databricks Workspace with SQL Editor highlighted in the left navigation under the SQL section, Queries listed below it, a New Query tab open with the New SQL editor: ON toggle at the top, an empty query editor, and a Run all (1000) button with a dropdown arrow.

Grant read access to source tables

Grant the service principal read access to the tables containing your experiment metrics. Run both GRANT USE commands, then run the GRANT SELECT option that matches your access needs. Replace <catalog>, <schema>, <table>, and <principal> with the appropriate values.

GRANT USE CATALOG ON CATALOG <catalog> TO `<principal>`;
GRANT USE SCHEMA ON SCHEMA <catalog>.<schema> TO `<principal>`;

-- Option 1: Give read access to a single table
GRANT SELECT ON TABLE <catalog>.<schema>.<table> TO `<principal>`;

-- Option 2: Give read access to all tables in the schema
GRANT SELECT ON ALL TABLES IN SCHEMA <catalog>.<schema> TO `<principal>`;

Create an output schema

Run the following commands to create a schema where Datadog Experiments can write intermediate results and temporary tables. Replace datadog_experiments_output with your output schema name, and <catalog> and <principal> with the appropriate values.

CREATE SCHEMA IF NOT EXISTS <catalog>.datadog_experiments_output;
GRANT USE SCHEMA ON SCHEMA <catalog>.datadog_experiments_output TO `<principal>`;
GRANT CREATE TABLE ON SCHEMA <catalog>.datadog_experiments_output TO `<principal>`;

Configure a volume for temporary data staging

Datadog Experiments uses a volume to temporarily save exposure data before copying it into a Databricks table. Run the following commands to create and grant access to this volume. Replace datadog_experiments_output with your output schema name, and <catalog> and <principal> with the appropriate values.

CREATE VOLUME IF NOT EXISTS <catalog>.datadog_experiments_output.datadog_experiments_volume;
GRANT READ VOLUME ON VOLUME <catalog>.datadog_experiments_output.datadog_experiments_volume TO `<principal>`;
GRANT WRITE VOLUME ON VOLUME <catalog>.datadog_experiments_output.datadog_experiments_volume TO `<principal>`;

Grant SQL warehouse access

Grant the service principal access to the SQL warehouse that Datadog Experiments uses to run queries.

  1. Navigate to SQL Warehouses in your Databricks Workspace.
  2. Select the warehouse for Datadog Experiments.
  3. At the top right corner, click Permissions.
  4. Grant the service principal the Can use permission.
  5. Close the Manage permissions modal.

Step 2: Connect Databricks to Datadog

To connect your Databricks Workspace to Datadog for warehouse-native experiment analysis:

  1. Navigate to Datadog's integrations page and search for Databricks.
  2. Click the Databricks tile to open its modal.
  3. Select the Configure tab and click Add Databricks Workspace. If this is your first Databricks account, the setup form appears automatically.
  4. Under the Connect a new Databricks Workspace section, enter:
    • Workspace Name.
    • Workspace URL.
    • Client ID.
    • Client Secret.
    • System Tables SQL Warehouse ID.
  5. Toggle off Jobs Monitoring and all other products.
  6. Toggle off the Metrics - Model Serving resource.
  7. Click Save Databricks Workspace.

To set this up for Amazon Redshift, connect a Redshift cluster to Datadog using the AWS integration and configure your experiment settings. This guide covers:

Prerequisites

Datadog Experiments connects to Redshift through Datadog's Amazon Web Services (AWS) integration. If you already have the AWS integration configured for the account containing your Redshift cluster, skip to Step 1.

Adding an AWS account requires the AWS Configurations Manage permission. If your organization uses custom roles, verify that your role includes this permission.

  1. Navigate to Datadog's integrations page and search for Amazon Web Services.
  2. Click the Amazon Web Services tile to open its modal.
  3. Click Add AWS Account(s) under the Configuration tab.
    1. If you do not yet have the AWS integration installed, Add AWS Account(s) appears on the AWS landing page after you open the integration tile.
  4. Follow the CloudFormation setup flow to create an IAM role that allows Datadog to make API calls to your AWS account:
    1. Select your AWS Region.
    2. Choose your Datadog API Key.
    3. Create a Datadog Application Key.
    4. Toggle off Deploy log forwarder and Disable All Log Resources (these are not needed for experiment analysis).
    5. Select No for Detect security issues.
    6. Click Open in AWS Console to launch your CloudFormation template. See the Getting Started with AWS documentation for instructions on navigating the AWS console.

You can follow your configuration's completion steps under Deployment Status on the integration setup page in Datadog.

If you plan to use other warehouse observability functionality in Datadog, see Datadog's Amazon Web Services integration documentation to determine which resources to enable.

Step 1: Prepare the Redshift cluster

Create a Datadog service user and a dedicated schema for Datadog to store experiment results and intermediate tables.

You must have superuser or admin privileges in the Redshift database to create the Datadog service user.

Create a Datadog service user in your Redshift database

Run the following command to create a service user with a strong password that Datadog can use to execute queries. Replace datadog_experiments_user with your user value and Your_Strong_Password with your password.

CREATE USER datadog_experiments_user PASSWORD 'Your_Strong_Password';

Create a Redshift output schema

Run the following commands to create a schema where Datadog can store experiment results and intermediate tables. Replace datadog_experiments_output with your schema name and datadog_experiments_user with your service user value.

CREATE SCHEMA IF NOT EXISTS datadog_experiments_output;
GRANT ALL ON SCHEMA datadog_experiments_output TO datadog_experiments_user;

Grant the service user read access to your metric data

Grant the service user read access to the tables or schemas that contain your source data. These are the tables you plan to use for experiment metrics, and are typically in a different schema than the output schema created above. Run the GRANT USAGE command, then run the GRANT SELECT option that matches your access needs. Replace datadog_experiments_user, <schema>, and <table> with the appropriate values.

GRANT USAGE ON SCHEMA <schema> TO datadog_experiments_user;

-- Option 1: Give read access to a single table
GRANT SELECT ON TABLE <schema>.<table> TO datadog_experiments_user;

-- Option 2: Give read access to all tables in the schema
GRANT SELECT ON ALL TABLES IN SCHEMA <schema> TO datadog_experiments_user;

Step 2: Create AWS resources and grant IAM permissions

Create an S3 bucket

Create an S3 bucket for importing exposure events into your warehouse. The bucket name must start with datadog-experimentation- (for example, datadog-experimentation-[aws_account_id]). You can use the bucket's default settings.

Grant additional IAM permissions

In addition to the permissions listed in the AWS integration documentation, Datadog Experiments requires additional IAM permissions to run warehouse-native experiment analysis.

Use the following table to gather the values for your environment, then add the policy statement below to the IAM role that your Datadog AWS integration uses.

FieldExample
[Redshift cluster ARN]arn:aws:redshift:us-east-1:[account-id]:namespace:[namespace-id]
[Redshift user ARN]arn:aws:redshift:us-east-1:[account-id]:dbuser:[cluster-name]/[user]
[Redshift database ARN]arn:aws:redshift:us-east-1:[account-id]:dbname:[cluster-name]
[S3 bucket ARN]arn:aws:s3:::[bucket-name]
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "RedshiftGetClusterCredentials",
      "Effect": "Allow",
      "Action": [
        "redshift:GetClusterCredentials"
      ],
      "Resource": [
        "[Redshift cluster ARN]",
        "[Redshift user ARN]",
        "[Redshift database ARN]"
      ]
    },
    {
      "Sid": "QueryRedshift",
      "Effect": "Allow",
      "Action": [
        "redshift-data:ExecuteStatement",
        "redshift-data:GetStatementResult",
        "redshift-data:DescribeStatement",
        "redshift-data:ListStatements",
        "redshift-data:CancelStatement"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ListExperimentationBucket",
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "[S3 bucket ARN]"
    },
    {
      "Sid": "ReadWriteExperimentationBucket",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": "[S3 bucket ARN]/*"
    }
  ]
}

To set this up for Snowflake, connect a Snowflake service account to Datadog and configure your experiment settings. This guide covers:

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 to create a public-private key pair for enhanced authentication. Datadog only supports unencrypted private keys.
  2. 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.
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.
  2. 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.
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.

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)

The role you created must have access to at least one warehouse to compute results. You must enter the warehouse name when configuring experiment settings in Step 3.

Creating a dedicated warehouse for Datadog Experiments is optional. Run the following commands to create one. Replace <wh_size> with the appropriate value.

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 and search for Snowflake.
  2. Click the Snowflake tile to open its modal.
  3. Select the Configure tab and click Add Snowflake Account.
  4. Add your Account URL. To find your account URL, see the Snowflake guide.
  5. Toggle off all resources (these are not needed for experiment analysis).
  6. Enter the Snowflake User Name you created in Step 1 (for example, datadog_experiments_user).
  7. Scroll to the Configure a key pair authentication section and upload your unencrypted private key.
  8. Click Save.

The grants in the Recommended Warehouse Settings section of the Snowflake integration tile are not needed for warehouse-native experiment analysis. The privileges granted in Step 1 are sufficient.

If you plan to use other warehouse observability functionality in Datadog, see Datadog's Snowflake integration documentation to determine which resources to enable.

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.

Step 3: Configure experiment settings

Datadog supports one warehouse connection per organization. Connecting BigQuery replaces any existing warehouse connection (for example, Snowflake).

After you set up your Google Cloud resources and IAM roles, configure the experiment settings in Datadog:

  1. Open Datadog Product Analytics.
  2. In the left navigation, hover over Settings and click Experiments.
  3. Select the Warehouse Connections tab.
  4. Click Connect a data warehouse. If you already have a warehouse connected, click Edit instead.
  5. Select the BigQuery tile.
  6. Under Select BigQuery Account, enter:
    • GCP service account: The service account you are using for Datadog Experiments.
    • Project: Your Google Cloud project.
  7. Under Dataset and GCS Bucket, enter:
    • Dataset: The dataset you created in Step 1 (for example, datadog_experiments_output).
    • GCS Bucket: The Cloud Storage bucket you created in Step 1.
  8. Click Save.
The Edit Data Warehouse modal with BigQuery selected, showing two sections: Select BigQuery Account with fields for GCP service account and Project, and Dataset and GCS Bucket with fields for Dataset and GCS Bucket.

After you save your warehouse connection, create experiment metrics using your BigQuery data.

Datadog supports one warehouse connection per organization. Connecting Databricks replaces any existing warehouse connection (for example, Snowflake).

After you set up your Databricks integration and workspace, configure the experiment settings in Datadog:

  1. Open Datadog Product Analytics.
  2. In the left navigation, hover over Settings and click Experiments.
  3. Select the Warehouse Connections tab.
  4. Click Connect a data warehouse. If you already have a warehouse connected, click Edit instead.
  5. Select the Databricks tile.
  6. Using the Account dropdown, select the Databricks Workspace you configured in Step 2.
  7. Enter the Catalog, Schema, and Volume name you configured in Step 1. If your catalog and schema do not appear in the dropdown, enter them manually to add them to the list.
  8. Click Save.
The Edit Data Warehouse modal with Databricks selected, showing input fields for Account, Catalog, Schema, and Volume Name.

After you save your warehouse connection, create experiment metrics using your Databricks data.

Datadog supports one warehouse connection per organization. Connecting Redshift replaces any existing warehouse connection (for example, Snowflake).

Configuring experiment settings requires the Product Analytics Settings Write permission. If your organization uses custom roles, verify that your role includes this permission.

After you set up your AWS integration and Redshift cluster, configure the experiment settings in Datadog:

  1. Open Datadog Product Analytics.
  2. In the left navigation, hover over Settings and click Experiments.
  3. Select the Warehouse Connections tab.
  4. Click Connect a data warehouse. If you already have a warehouse connected, click Edit instead.
  5. Select the Redshift tile.
  6. Select your AWS account from the dropdown.
  7. Under Cluster Connection, enter:
    • AWS region: The region your Redshift cluster is in (for example, us-east-1).
    • Cluster identifier: The name of your Redshift cluster.
    • Cluster endpoint: The full endpoint URL for your cluster.
    • Port: The port your cluster is listening on (default: 5439).
  8. Under Database and Storage, enter:
    • Database: The name of the database containing your source tables.
    • Database user: The service user you created in Step 1 (for example, datadog_experiments_user).
    • Schema: The schema you created in Step 1 for Datadog Experiments to write to (for example, datadog_experiments_output).
    • Temp S3 bucket: The S3 bucket you created in Step 2 (for example, datadog-experimentation-[aws_account_id]).
  9. Click Save.
The Redshift connection setup page in Datadog showing warehouse type tiles for Snowflake, BigQuery, Redshift (selected), and Databricks, with three sections: Select AWS Account with an AWS account dropdown, Cluster Connection with fields for AWS region, Cluster identifier, Cluster endpoint, and Port, and Database and Storage with fields for Database, Database user, Schema, and Temp S3 bucket.

After you save your warehouse connection, create experiment metrics using your Redshift data.

Datadog supports one warehouse connection per organization. Connecting Snowflake replaces any existing warehouse connection (for example, Redshift).

After you set up your Snowflake integration, configure the experiment settings in Datadog Product Analytics:

  1. In the left navigation, hover over Settings, then click Experiments.
  2. Select the Warehouse Connections tab.
  3. Click Connect a data warehouse. If you already have a warehouse connected, click Edit instead.
  4. Select the Snowflake tile.
  5. Enter the Account, Role, Warehouse, Database, and Schema you configured in Step 1. If your database and schema do not appear in the dropdown, enter them manually to add them to the list.
  6. Click Save.
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.

After you save your warehouse connection, create experiment metrics using your Snowflake data.

Further reading