> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/use-fme/warehouse-native-experimentation/setup/assignment-sources.md).

# Preparing Assignment Source Tables for Warehouse Native Experimentation

To prepare an [Assignment Source](/feature-management-experimentation/use-fme/warehouse-native-experimentation/setup/configure-assignments.md) for Warehouse Native Experimentation, transform your raw exposure or impression logs into a clean, standardized table that serves as the foundation for experimentation analyses.

This page describes the required fields, recommended fields, and best practices for preparing your assignment source tables.

### Required columns <a href="#required-columns" id="required-columns"></a>

{% hint style="info" %}
These fields are mandatory. Without them, Harness FME cannot map exposures to experiment results.
{% endhint %}

Every Assignment Source table must include the following columns:

| Column                        | Type                     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Unique Key**                | `STRING`                 | Unique identifier for the unit of randomization (for example, `user_id`, `account_id`, or a custom key). Must be stable across the experiment duration.                                                                                                                                                                                                                                                                                                                         |
| **Exposure Timestamp**        | `DATETIME` / `TIMESTAMP` | <p>The time the assignment occurred (for example, when an impression was logged, a flag evaluated, or <code>getTreatment</code> was called). Must be provided in epoch milliseconds or UTC format (e.g. <code>1714953600000</code> or <code>2026-05-05T00:00:00Z</code>).<br><br>Timestamps must be in UTC (epoch milliseconds or UTC datetime) and align with the format used in <a href="/pages/qQ029TcVzXe4TqbtZrmv">Metric Sources</a> for accurate joins and analysis.</p> |
| **Treatment (Variant Group)** | `STRING`                 | The assigned experiment variant (for example, `control`, `treatment_a`, `variant_1`).                                                                                                                                                                                                                                                                                                                                                                                           |

### Recommended columns <a href="#recommended-columns" id="recommended-columns"></a>

While not required, the following fields make debugging, filtering, and governance more efficient.

| Column                   | Type     | Description                                                                                                                                                                                                                                                                             |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Experiment ID / Name** | `STRING` | Helps differentiate exposures when multiple experiments are logged in the same raw table.                                                                                                                                                                                               |
| **Targeting Rule**       | `STRING` | Indicates which targeting rule or condition led to the assignment. Useful for audit and debugging. If you are using FME feature flag impressions, filter by a single targeting rule to ensure the experiment analyzes the intended population.                                          |
| **Environment ID**       | `STRING` | Allows filtering by environment (for example, `production`, `staging`). When configuring an assignment source in FME, you can map column values to a matching Harness environment or hard-code a single environment. When creating an experiment, it must be scoped to one environment. |
| **Traffic Type**         | `STRING` | Distinguishes the unit type (for example, `user`, `account`, `anonymous visitor`). When configuring an assignment source, you can map column values or hard-code the environment. Each experiment must be scoped to one traffic type.                                                   |

### Common raw table schemas <a href="#common-raw-table-schemas" id="common-raw-table-schemas"></a>

Most organizations log impressions or exposures from feature flag evaluations, SDKs, or event pipelines. Below are common raw schemas and how to normalize them.

#### Feature Flag Evaluation Logs <a href="#feature-flag-evaluation-logs" id="feature-flag-evaluation-logs"></a>

| **Example Raw Schema**                                                                                                                                                  | **Transformations**                                                                                                                                                                                                                                                                               |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>user\_id</code><br><code>flag\_name</code><br><code>treatment</code><br><code>impression\_time</code><br><code>environment</code><br><code>rule\_id</code></p> | <p>• Map <code>flag\_name</code> values → <code>experiment\_id</code> (if multiple flags correspond to the same experiment).<br>• Cast <code>evaluation\_time</code> to <code>TIMESTAMP</code>.<br>• Deduplicate on <code>(user\_id, experiment\_id)</code> by keeping the earliest exposure.</p> |

#### A/B Test Impression Logs <a href="#ab-test-impression-logs" id="ab-test-impression-logs"></a>

| **Example Raw Schema**                                                                                                                  | **Transformations**                                                                                                                                                                                                             |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>experiment\_id</code><br><code>user\_id</code><br><code>bucket</code> or <code>arm</code><br><code>impression\_time</code></p> | <p>• Standardize <code>bucket</code> → <code>treatment</code>.<br>• Standardize <code>impression\_time</code> → <code>exposure\_timestamp</code>.<br>• Deduplicate to keep only the first exposure per user per experiment.</p> |

#### Event Logging Pipelines (Custom Analytics Events) <a href="#event-logging-pipelines-custom-analytics-events" id="event-logging-pipelines-custom-analytics-events"></a>

| **Example Raw Schema**                                                                                                                                                       | **Transformations**                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>event\_name</code><br><code>event\_time</code><br><code>properties.experiment\_id</code><br><code>properties.variant</code><br><code>properties.user\_id</code></p> | <p>• Flatten nested fields (<code>JSON</code> → explicit columns).<br>• Filter to only <code>event\_name = 'experiment\_exposure'</code>.<br>• Standardize column names to match required schema.</p> |

### Prepare your assignment table <a href="#prepare-your-assignment-table" id="prepare-your-assignment-table"></a>

Follow these best practices for preparing your assignment table in your data warehouse.

* **De-duplication**: Keep only the earliest exposure per user per experiment. For example:

  ```sql
  QUALIFY ROW_NUMBER() OVER (
    PARTITION BY user_id, experiment_id
    ORDER BY exposure_timestamp ASC
  ) = 1
  ```
* **Consistent Variant Labels**: Standardize variant naming (`control`, `treatment`, `variant_1`) across experiments. Avoid null or empty strings; default to `control` if needed.
* **Timestamp Format**: All exposure timestamps must be in epoch milliseconds or UTC (ISO 8601).
* **Use UTC Consistently**: Store all exposure and event timestamps in UTC to ensure consistent comparisons across regions.
* **Stable Identifiers**: Use the same user or account key across Assignment Source and Metric Source tables. If your system logs multiple IDs (for example, `cookie_id` and `user_id`), choose the most stable one.
* **Environment Separation**: If raw tables mix environments (for example, `staging` and `production`), add an `environment_id` column and filter accordingly. This prevents accidental inclusion of test data in production environments.
* **Partitioning and Indexing**: Partition large tables by `DATE(exposure_timestamp)` to optimize query performance. Cluster or index by `experiment_id` and `user_id` for faster lookups.

### Example prepared table schema <a href="#example-prepared-table-schema" id="example-prepared-table-schema"></a>

| Column               | Type        | Example                |
| -------------------- | ----------- | ---------------------- |
| `user_id`            | `STRING`    | `abc123`               |
| `experiment_id`      | `STRING`    | `checkout_flow_v2`     |
| `treatment`          | `STRING`    | `control`              |
| `exposure_timestamp` | `TIMESTAMP` | `2025-03-14T12:45:00Z` |
| `environment_id`     | `STRING`    | `prod`                 |
| `traffic_type`       | `STRING`    | `user`                 |

Once your Assignment Source tables are prepared and validated, see [Setting Up an Assignment Source](/feature-management-experimentation/use-fme/warehouse-native-experimentation/setup/index.md) to connect them in Harness FME.
