> ## Documentation Index
> Fetch the complete documentation index at: https://data-foundation.rockerbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Snowflake

> Setup guide to share Rockerbox schemas with your Snowflake account.

## Pre-Requisites

* A Snowflake account
* A user with `ACCOUNTADMIN` or admin access

> Rockerbox uses [Snowflake's Secure Data Sharing](https://docs.snowflake.com/en/user-guide/data-sharing-intro) to share Rockerbox datasets with your Snowflake account.

***

## Step 1: Select Snowflake in the Rockerbox UI

1. Navigate to the [Warehousing setup page](https://app.rockerbox.com/v3/data/exports/data_warehouse) in Rockerbox.
2. Select **Snowflake** as your destination.
3. Click **Connect to Snowflake**.

***

## Step 2: Gather Snowflake account context

1. Login to your Snowflake account.
2. Open the Query Editor, and run the following SQL:

```sql theme={null}
SELECT CURRENT_REGION(), CURRENT_ACCOUNT();
```

***

## Step 3: Enter Snowflake account context in Rockerbox

1. **Cloud Platform**\
   Select your platform from the dropdown (e.g. `aws`, `gcp`, `azure`)
   > 💡 This is the **prefix** of the value from `CURRENT_REGION()`\
   > Example:\
   > If the result is `aws_us_east_1`, then Cloud Platform = `aws`

2. **Cloud Region**\
   Select your region (e.g. `us_east_1`)
   > 💡 This is the **suffix** of the value from `CURRENT_REGION()`\
   > Example:\
   > If the result is `aws_us_east_1`, then Cloud Region = `us_east_1`

3. **Account Locator**\
   Paste the value returned by `CURRENT_ACCOUNT()`

4. Click **✅ Setup Share**

***

## Step 4: Create the Rockerbox Database

* Execute the query provided by Rockerbox in the Snowflake query editor to create the database.
  * ⚠️ Note: Requires the `ACCOUNTADMIN` role.
  * 💡 You may rename the `rockerbox` database if it already exists — but do not modify the rest of the query.

***

## Step 5: Sync Rockerbox Data Sets

* Choose which datasets to share:
  * **Platform Data**: Select the ad platforms you actively use.
  * **Rockerbox Data**: Select **Conversion** and any **Log Level MTA** datasets for each conversion event that you need.
* Click **Sync this dataset** when ready.

📦 `aggregate_mta` and `taxonomy_lookup` tables are automatically created in the data share.

### ⚠️ Backfill Notes

* **Platform Performance Schemas**: No data is automatically backfilled. This can be backfilled on a limited basis upon request to `support@rockerbox.com`.
* **Rockerbox First Party Data Schemas**: For each conversion dataset, Rockerbox will backfill based on the conversion event “First Reporting Date” in Rockerbox\
  💡 If no date is set, Rockerbox backfills one day of data. This process can take up to **24 hours**.

***

## Step 6: Query your new data tables

### Sample queries: `aggregate_mta` table

Test setup

```sql theme={null}
SELECT * FROM <share_db>.public.aggregate_mta LIMIT 1;
```

Report even weight attributed conversions and spend by conversion event + tier\_1 (most broad reporting taxonomy dimension)

```sql theme={null}
SELECT 
    conversion_event_name,
    tier_1,
    SUM(even) as conversions_even,
    SUM(included_spend) as spend
FROM <share_db>.public.aggregate_mta
WHERE 
    date >= DATEADD(day, -7, CURRENT_DATE)
    AND date < current_date;
```
