> For the complete documentation index, see [llms.txt](https://developer.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mediarithmics.io/advanced-usages/exporting-your-data/datamart-replication/data-warehouse-replication.md).

# Data warehouse replication

## Overview

A Data Warehouse replication continuously delivers the data from mediarithmics into your own data warehouse, through an intermediate cloud storage bucket.

### Data flow <a href="#data-flow" id="data-flow"></a>

```
mediarithmics  ─►  cloud storage bucket (Avro files)  ─►  your warehouse (tables)
```

1. **mediarithmics → bucket** — replicated operations are written as **Avro files** into a cloud storage bucket
2. **bucket → warehouse** — those files are exposed as **tables** in your warehouse, per document type

The Avro files are loaded every 15 minutes in the bucket. Each document type has a **log** table (all operations, append-only) and a **state** table (the current, deduplicated view). A **daily job** rebuilds the state tables from the logs.

### Supported buckets per destination <a href="#supported-buckets-per-destination" id="supported-buckets-per-destination"></a>

| Warehouse destination | Supported bucket                        |
| --------------------- | --------------------------------------- |
| BigQuery              | Google Cloud Storage (GCS)              |
| Snowflake             | Google Cloud Storage (GCS) or Amazon S3 |

You provide the bucket credentials (GCS HMAC key or S3 access key) when setting up the replication.

{% hint style="info" %}
For more information on how to set up a connection to you data warehouse in mediarithmics see [Data warehouse management](/advanced-usages/data-warehouse-management.md)
{% endhint %}

## Avro files description <a href="#data-warehouse-replication--avro-files-on-the-bucket" id="data-warehouse-replication--avro-files-on-the-bucket"></a>

This section describes the **Avro files** that a `DATA_WAREHOUSE` datamart replication writes into the intermediate cloud storage bucket, and gives the exact record schema for **each document type** that can be replicated.

Every file is a standard **Avro Object Container File** (`.avro`) with **one record type per file** — a file only ever contains one `…OperationRecord` type

#### File naming and partitioning <a href="#file-naming-and-partitioning" id="file-naming-and-partitioning"></a>

Files are laid out in a **Hive-style partitioned** directory tree. One top-level folder per document type, then partitioned by hour:

```
<bucket>/<path>/type=<RecordName>/year=YYYY/month=MM/day=DD/hour=HH/data_<partitionId>_offset_<fromOffset>.avro
```

For example:

```
my-bucket/replication=12345/type=UserProfileOperationRecord/year=2026/month=07/day=13/hour=14/data_0_offset_0.avro
```

### Document types and their records <a href="#document-types-and-their-records" id="document-types-and-their-records"></a>

Each document you select in the replication filters maps to exactly one Avro record type, i.e. one `type=…` folder / one warehouse table.

<table data-header-hidden><thead><tr><th width="268.66668701171875">Replication filter document</th><th>Bucket folder (type=…) / warehouse table</th></tr></thead><tbody><tr><td><code>USER_SEGMENT</code></td><td><code>UserSegmentOperationRecord</code></td></tr><tr><td><code>USER_DEVICE_POINT</code></td><td><code>UserDevicePointOperationRecord</code></td></tr><tr><td><code>USER_DEVICE_TECHNICAL_ID</code></td><td><code>UserDeviceTechnicalIdOperationRecord</code></td></tr><tr><td><code>USER_ACCOUNT</code></td><td><code>UserAccountOperationRecord</code></td></tr><tr><td><code>USER_EMAIL</code></td><td><code>UserEmailOperationRecord</code></td></tr><tr><td><code>USER_PROFILE</code></td><td><code>UserProfileOperationRecord</code></td></tr><tr><td><code>USER_ACTIVITY</code></td><td><code>UserActivityOperationRecord</code></td></tr><tr><td><code>USER_EVENT</code></td><td><code>UserEventOperationRecord</code></td></tr><tr><td><code>USER_COMPUTED_FIELD</code></td><td><code>UserComputedFieldOperationRecord</code></td></tr></tbody></table>

### Record schemas <a href="#record-schemas" id="record-schemas"></a>

There is **one Avro record per document type**. Each `.avro` file embeds the schema of its own record. All records share the same three leading fields — `ts` (`timestamp-micros`), `op` (`OperationType` enum: `UPDATE` / `DELETE`) and `user_point_id` (`uuid`).

In these schemas `data` is a JSON `string` and `user_identifiers` is an `array` — this is the raw Avro shape written on the bucket (the conversion to `VARIANT` / `JSON` happens later, in the state tables).

#### `UserSegmentOperationRecord` <a href="#usersegmentoperationrecord" id="usersegmentoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserSegmentOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "segment_id",
      "type": "long"
    },
    {
      "name": "creation_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    },
    {
      "name": "last_modified_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    }
  ]
}
```

#### `UserDevicePointOperationRecord` <a href="#userdevicepointoperationrecord" id="userdevicepointoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserDevicePointOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "user_device_point_id",
      "type": "long"
    },
    {
      "name": "creation_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "form_factor",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "os_family",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "os_version",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "browser_family",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "brand",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "model",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "carrier",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "agent_type",
      "type": [
        "null",
        "string"
      ]
    }
  ]
}
```

#### `UserDeviceTechnicalIdOperationRecord` <a href="#userdevicetechnicalidoperationrecord" id="userdevicetechnicalidoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserDeviceTechnicalIdOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "user_device_point_id",
      "type": "long"
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    },
    {
      "name": "registry_type",
      "type": {
        "name": "RegistryType",
        "type": "enum",
        "symbols": [
          "INSTALLATION_ID",
          "MUM_ID",
          "NETWORK_DEVICE_ID",
          "CUSTOM_DEVICE_ID",
          "MOBILE_ADVERTISING_ID",
          "MOBILE_VENDOR_ID",
          "TV_ADVERTISING_ID",
          "IP_V4_ADDRESS_ID",
          "IP_V6_ADDRESS_ID"
        ]
      }
    },
    {
      "name": "registry_id",
      "type": "long"
    },
    {
      "name": "user_device_technical_id_value",
      "type": "string"
    },
    {
      "name": "last_seen_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    }
  ]
}
```

#### `UserAccountOperationRecord` <a href="#useraccountoperationrecord" id="useraccountoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserAccountOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "compartment_id",
      "type": "long"
    },
    {
      "name": "user_account_id",
      "type": "string"
    },
    {
      "name": "creation_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    }
  ]
}
```

#### `UserEmailOperationRecord` <a href="#useremailoperationrecord" id="useremailoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserEmailOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "email_hash",
      "type": "string"
    },
    {
      "name": "email",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "creation_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    }
  ]
}
```

#### `UserProfileOperationRecord` <a href="#userprofileoperationrecord" id="userprofileoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserProfileOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "compartment_id",
      "type": "long"
    },
    {
      "name": "user_account_id",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "creation_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    },
    {
      "name": "last_modified_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "data",
      "type": [
        "null",
        "string"
      ],
      "doc": "The object in JSON format"
    }
  ]
}
```

#### `UserActivityOperationRecord` <a href="#useractivityoperationrecord" id="useractivityoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserActivityOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "activity_key",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      }
    },
    {
      "name": "channel_id",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "schema_id",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "user_identifiers",
      "type": {
        "type": "array",
        "items": {
          "name": "UserIdentifier",
          "type": "record",
          "fields": [
            {
              "name": "type",
              "type": {
                "name": "UserIdentifierType",
                "type": "enum",
                "symbols": [
                  "EMAIL_HASH",
                  "USER_ACCOUNT_ID",
                  "USER_DEVICE_TECHNICAL_ID"
                ]
              }
            },
            {
              "name": "registry_type",
              "type": [
                "null",
                {
                  "name": "RegistryType",
                  "type": "enum",
                  "symbols": [
                    "INSTALLATION_ID",
                    "MUM_ID",
                    "NETWORK_DEVICE_ID",
                    "CUSTOM_DEVICE_ID",
                    "MOBILE_ADVERTISING_ID",
                    "MOBILE_VENDOR_ID",
                    "TV_ADVERTISING_ID",
                    "IP_V4_ADDRESS_ID",
                    "IP_V6_ADDRESS_ID"
                  ]
                }
              ],
              "default": null
            },
            {
              "name": "registry_id",
              "type": [
                "null",
                "string"
              ],
              "default": null
            },
            {
              "name": "compartment_id",
              "type": [
                "null",
                "string"
              ],
              "default": null
            },
            {
              "name": "value",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    },
    {
      "name": "schema_error",
      "type": [
        "null",
        "boolean"
      ]
    },
    {
      "name": "data",
      "type": "string",
      "doc": "The object in JSON format"
    }
  ]
}
```

#### `UserEventOperationRecord` <a href="#usereventoperationrecord" id="usereventoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserEventOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "activity_key",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      }
    },
    {
      "name": "event_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      }
    },
    {
      "name": "channel_id",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "event_name",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "schema_id",
      "type": [
        "null",
        "string"
      ]
    },
    {
      "name": "user_identifiers",
      "type": {
        "type": "array",
        "items": {
          "name": "UserIdentifier",
          "type": "record",
          "fields": [
            {
              "name": "type",
              "type": {
                "name": "UserIdentifierType",
                "type": "enum",
                "symbols": [
                  "EMAIL_HASH",
                  "USER_ACCOUNT_ID",
                  "USER_DEVICE_TECHNICAL_ID"
                ]
              }
            },
            {
              "name": "registry_type",
              "type": [
                "null",
                {
                  "name": "RegistryType",
                  "type": "enum",
                  "symbols": [
                    "INSTALLATION_ID",
                    "MUM_ID",
                    "NETWORK_DEVICE_ID",
                    "CUSTOM_DEVICE_ID",
                    "MOBILE_ADVERTISING_ID",
                    "MOBILE_VENDOR_ID",
                    "TV_ADVERTISING_ID",
                    "IP_V4_ADDRESS_ID",
                    "IP_V6_ADDRESS_ID"
                  ]
                }
              ],
              "default": null
            },
            {
              "name": "registry_id",
              "type": [
                "null",
                "string"
              ],
              "default": null
            },
            {
              "name": "compartment_id",
              "type": [
                "null",
                "string"
              ],
              "default": null
            },
            {
              "name": "value",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "name": "expiration_ts",
      "type": [
        "null",
        {
          "type": "long",
          "logicalType": "timestamp-micros"
        }
      ]
    },
    {
      "name": "schema_error",
      "type": [
        "null",
        "boolean"
      ]
    },
    {
      "name": "data",
      "type": [
        "null",
        "string"
      ],
      "doc": "The object in JSON format"
    }
  ]
}
```

#### `UserComputedFieldOperationRecord` <a href="#usercomputedfieldoperationrecord" id="usercomputedfieldoperationrecord"></a>

```json
{
  "type": "record",
  "name": "UserComputedFieldOperationRecord",
  "namespace": "com.mediarithmics.replication.format.tabular",
  "fields": [
    {
      "name": "ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "op",
      "type": {
        "name": "OperationType",
        "type": "enum",
        "symbols": [
          "UPDATE",
          "DELETE"
        ]
      }
    },
    {
      "name": "user_point_id",
      "type": {
        "type": "string",
        "logicalType": "uuid"
      },
      "doc": "The UserPoint id"
    },
    {
      "name": "plugin_instance_id",
      "type": "long"
    },
    {
      "name": "last_modified_ts",
      "type": {
        "type": "long",
        "logicalType": "timestamp-micros"
      }
    },
    {
      "name": "data",
      "type": [
        "null",
        "string"
      ],
      "doc": "The object in JSON format"
    }
  ]
}
```

## Log & state table schemas <a href="#data-warehouse-replication--log-andamp-state-table-schemas" id="data-warehouse-replication--log-andamp-state-table-schemas"></a>

For each document type, the warehouse holds a **log** table (`<document>_log`, all operations) and a **state** table (`<document>`, deduplicated current state). Each column's type is given for both Snowflake and BigQuery.

> On Snowflake, every **log** table also has these extra columns: `partition_date DATE`, `year`, `month`, `day`, `hour` (`NUMBER`). On BigQuery the log table is an external table over the Avro files (schema auto-detected). State tables add `partition_date DATE` on Snowflake only.

### Avro → warehouse type mapping <a href="#avro-warehouse-type-mapping" id="avro-warehouse-type-mapping"></a>

| Avro type                   | Snowflake       | BigQuery          |
| --------------------------- | --------------- | ----------------- |
| `long` + `timestamp-micros` | `TIMESTAMP_NTZ` | `TIMESTAMP`       |
| `string` (incl. `uuid`)     | `STRING`        | `STRING`          |
| `enum`                      | `STRING`        | `STRING`          |
| `long`                      | `NUMBER`        | `INT64`           |
| `int`                       | `INT`           | `INT64`           |
| `boolean`                   | `BOOLEAN`       | `BOOL`            |
| `array`                     | `ARRAY`         | `RECORD REPEATED` |
| `record`                    | `OBJECT`        | `RECORD`          |

In **state** tables, `long` columns are `BIGINT` (Snowflake) / `INT64` (BigQuery), and JSON payloads (`data`, `user_identifiers`) are stored as `VARIANT` (Snowflake) / `JSON` (BigQuery).

### `user_segment` <a href="#user_segment" id="user_segment"></a>

**Log** (`user_segment_log`)

| Column             | Snowflake      | BigQuery  |
| ------------------ | -------------- | --------- |
| `ts`               | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`               | STRING         | STRING    |
| `user_point_id`    | STRING         | STRING    |
| `segment_id`       | NUMBER         | INT64     |
| `creation_ts`      | TIMESTAMP\_NTZ | TIMESTAMP |
| `expiration_ts`    | TIMESTAMP\_NTZ | TIMESTAMP |
| `last_modified_ts` | TIMESTAMP\_NTZ | TIMESTAMP |

**State** (`user_segment`) — cluster by `segment_id`

| Column          | Snowflake | BigQuery  |
| --------------- | --------- | --------- |
| `user_point_id` | STRING    | STRING    |
| `segment_id`    | BIGINT    | INT64     |
| `ts`            | TIMESTAMP | TIMESTAMP |

***

### `user_device_point` <a href="#user_device_point" id="user_device_point"></a>

**Log** (`user_device_point_log`)

| Column                 | Snowflake      | BigQuery  |
| ---------------------- | -------------- | --------- |
| `ts`                   | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`                   | STRING         | STRING    |
| `user_point_id`        | STRING         | STRING    |
| `user_device_point_id` | NUMBER         | INT64     |
| `creation_ts`          | TIMESTAMP\_NTZ | TIMESTAMP |
| `form_factor`          | STRING         | STRING    |
| `os_family`            | STRING         | STRING    |
| `os_version`           | STRING         | STRING    |
| `browser_family`       | STRING         | STRING    |
| `brand`                | STRING         | STRING    |
| `model`                | STRING         | STRING    |
| `carrier`              | STRING         | STRING    |
| `agent_type`           | STRING         | STRING    |

**State** (`user_device_point`) — no clustering

| Column                 | Snowflake | BigQuery  |
| ---------------------- | --------- | --------- |
| `user_point_id`        | STRING    | STRING    |
| `user_device_point_id` | BIGINT    | INT64     |
| `brand`                | STRING    | STRING    |
| `model`                | STRING    | STRING    |
| `agent_type`           | STRING    | STRING    |
| `browser_family`       | STRING    | STRING    |
| `form_factor`          | STRING    | STRING    |
| `os_family`            | STRING    | STRING    |
| `ts`                   | TIMESTAMP | TIMESTAMP |

***

### `user_device_technical_id` <a href="#user_device_technical_id" id="user_device_technical_id"></a>

**Log** (`user_device_technical_id_log`)

| Column                           | Snowflake      | BigQuery  |
| -------------------------------- | -------------- | --------- |
| `ts`                             | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`                             | STRING         | STRING    |
| `user_point_id`                  | STRING         | STRING    |
| `user_device_point_id`           | NUMBER         | INT64     |
| `expiration_ts`                  | TIMESTAMP\_NTZ | TIMESTAMP |
| `registry_type`                  | STRING         | STRING    |
| `registry_id`                    | NUMBER         | INT64     |
| `user_device_technical_id_value` | STRING         | STRING    |
| `last_seen_ts`                   | TIMESTAMP\_NTZ | TIMESTAMP |

**State** (`user_device_technical_id`) — cluster by `registry_id`

| Column                     | Snowflake | BigQuery  |
| -------------------------- | --------- | --------- |
| `user_point_id`            | STRING    | STRING    |
| `user_device_technical_id` | STRING    | STRING    |
| `registry_type`            | STRING    | STRING    |
| `registry_id`              | BIGINT    | INT64     |
| `id`                       | STRING    | STRING    |
| `user_device_point_id`     | BIGINT    | INT64     |
| `last_seen_ts`             | TIMESTAMP | TIMESTAMP |
| `expiration_ts`            | TIMESTAMP | TIMESTAMP |
| `ts`                       | TIMESTAMP | TIMESTAMP |

***

### `user_account` <a href="#user_account" id="user_account"></a>

**Log** (`user_account_log`)

| Column            | Snowflake      | BigQuery  |
| ----------------- | -------------- | --------- |
| `ts`              | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`              | STRING         | STRING    |
| `user_point_id`   | STRING         | STRING    |
| `compartment_id`  | NUMBER         | INT64     |
| `user_account_id` | STRING         | STRING    |
| `creation_ts`     | TIMESTAMP\_NTZ | TIMESTAMP |
| `expiration_ts`   | TIMESTAMP\_NTZ | TIMESTAMP |

**State** (`user_account`) — cluster by `compartment_id`

| Column            | Snowflake | BigQuery  |
| ----------------- | --------- | --------- |
| `user_point_id`   | STRING    | STRING    |
| `compartment_id`  | BIGINT    | INT64     |
| `user_account_id` | STRING    | STRING    |
| `ts`              | TIMESTAMP | TIMESTAMP |

***

### `user_email` <a href="#user_email" id="user_email"></a>

**Log** (`user_email_log`)

| Column          | Snowflake      | BigQuery  |
| --------------- | -------------- | --------- |
| `ts`            | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`            | STRING         | STRING    |
| `user_point_id` | STRING         | STRING    |
| `email_hash`    | STRING         | STRING    |
| `email`         | STRING         | STRING    |
| `creation_ts`   | TIMESTAMP\_NTZ | TIMESTAMP |
| `expiration_ts` | TIMESTAMP\_NTZ | TIMESTAMP |

**State** (`user_email`) — no clustering

| Column          | Snowflake | BigQuery  |
| --------------- | --------- | --------- |
| `user_point_id` | STRING    | STRING    |
| `email_hash`    | STRING    | STRING    |
| `email`         | STRING    | STRING    |
| `ts`            | TIMESTAMP | TIMESTAMP |

***

### `user_profile` <a href="#user_profile" id="user_profile"></a>

**Log** (`user_profile_log`)

| Column             | Snowflake      | BigQuery  |
| ------------------ | -------------- | --------- |
| `ts`               | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`               | STRING         | STRING    |
| `user_point_id`    | STRING         | STRING    |
| `compartment_id`   | NUMBER         | INT64     |
| `user_account_id`  | STRING         | STRING    |
| `creation_ts`      | TIMESTAMP\_NTZ | TIMESTAMP |
| `expiration_ts`    | TIMESTAMP\_NTZ | TIMESTAMP |
| `last_modified_ts` | TIMESTAMP\_NTZ | TIMESTAMP |
| `data`             | STRING         | STRING    |

**State** (`user_profile`) — cluster by `compartment_id`

| Column            | Snowflake | BigQuery  |
| ----------------- | --------- | --------- |
| `user_point_id`   | STRING    | STRING    |
| `compartment_id`  | BIGINT    | INT64     |
| `user_account_id` | STRING    | STRING    |
| `data`            | VARIANT   | JSON      |
| `ts`              | TIMESTAMP | TIMESTAMP |

***

### `user_activity` <a href="#user_activity" id="user_activity"></a>

**Log** (`user_activity_log`)

| Column             | Snowflake      | BigQuery        |
| ------------------ | -------------- | --------------- |
| `ts`               | TIMESTAMP\_NTZ | TIMESTAMP       |
| `op`               | STRING         | STRING          |
| `user_point_id`    | STRING         | STRING          |
| `activity_key`     | STRING         | STRING          |
| `channel_id`       | STRING         | STRING          |
| `schema_id`        | STRING         | STRING          |
| `user_identifiers` | ARRAY          | RECORD REPEATED |
| `expiration_ts`    | TIMESTAMP\_NTZ | TIMESTAMP       |
| `schema_error`     | BOOLEAN        | BOOL            |
| `data`             | STRING         | STRING          |

**State** (`user_activity`) — no clustering

| Column             | Snowflake | BigQuery  |
| ------------------ | --------- | --------- |
| `user_point_id`    | STRING    | STRING    |
| `activity_key`     | STRING    | STRING    |
| `channel_id`       | STRING    | STRING    |
| `user_identifiers` | VARIANT   | JSON      |
| `expiration_ts`    | TIMESTAMP | TIMESTAMP |
| `data`             | VARIANT   | JSON      |
| `ts`               | TIMESTAMP | TIMESTAMP |

***

### `user_event` <a href="#user_event" id="user_event"></a>

**Log** (`user_event_log`)

| Column             | Snowflake      | BigQuery        |
| ------------------ | -------------- | --------------- |
| `ts`               | TIMESTAMP\_NTZ | TIMESTAMP       |
| `op`               | STRING         | STRING          |
| `user_point_id`    | STRING         | STRING          |
| `activity_key`     | STRING         | STRING          |
| `event_id`         | STRING         | STRING          |
| `channel_id`       | STRING         | STRING          |
| `event_name`       | STRING         | STRING          |
| `schema_id`        | STRING         | STRING          |
| `user_identifiers` | ARRAY          | RECORD REPEATED |
| `expiration_ts`    | TIMESTAMP\_NTZ | TIMESTAMP       |
| `schema_error`     | BOOLEAN        | BOOL            |
| `data`             | STRING         | STRING          |

**State** (`user_event`) — cluster by `activity_key`

| Column             | Snowflake | BigQuery  |
| ------------------ | --------- | --------- |
| `user_point_id`    | STRING    | STRING    |
| `event_id`         | STRING    | STRING    |
| `activity_key`     | STRING    | STRING    |
| `channel_id`       | STRING    | STRING    |
| `event_name`       | STRING    | STRING    |
| `user_identifiers` | VARIANT   | JSON      |
| `expiration_ts`    | TIMESTAMP | TIMESTAMP |
| `data`             | VARIANT   | JSON      |
| `ts`               | TIMESTAMP | TIMESTAMP |

***

### `user_computed_field` <a href="#user_computed_field" id="user_computed_field"></a>

**Log** (`user_computed_field_log`)

| Column               | Snowflake      | BigQuery  |
| -------------------- | -------------- | --------- |
| `ts`                 | TIMESTAMP\_NTZ | TIMESTAMP |
| `op`                 | STRING         | STRING    |
| `user_point_id`      | STRING         | STRING    |
| `plugin_instance_id` | NUMBER         | INT64     |
| `last_modified_ts`   | TIMESTAMP\_NTZ | TIMESTAMP |
| `data`               | STRING         | STRING    |

**State** (`user_computed_field`) — cluster by `plugin_instance_id`

| Column               | Snowflake | BigQuery  |
| -------------------- | --------- | --------- |
| `user_point_id`      | STRING    | STRING    |
| `plugin_instance_id` | BIGINT    | INT64     |
| `data`               | VARIANT   | JSON      |
| `ts`                 | TIMESTAMP | TIMESTAMP |

***

Setting up replication

In order to set up a replication to your data warehouse, follow these steps&#x20;

* [BigQuery](/advanced-usages/exporting-your-data/datamart-replication/data-warehouse-replication/bigquery.md)
* [Snowflake](/advanced-usages/exporting-your-data/datamart-replication/data-warehouse-replication/snowflake.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.mediarithmics.io/advanced-usages/exporting-your-data/datamart-replication/data-warehouse-replication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
