# Assignment Sources

Assignment Sources define the schema for your assignment data in Statsig. They serve as the input for determining which users are in an experiment and which treatment each user received.

## Creating an assignment source

To create an assignment source, navigate to the data tab in Statsig and open the Assignment Sources pane.

An Assignment Source is a SQL query and a mapping of the output columns to specific fields
Statsig requires (user identifiers, a `timestamp`, an experiment identifier, and a group identifier).

{% figure %}
![Assignment Source](https://docs.statsig.com/images/statsig-warehouse-native/configuration/assignment-sources/264100295-05d71c64-9b31-4531-b371-03b6cb692446.png)
{% /figure %}

## Scanning assignment sources

Statsig scans assignment sources on-demand or on a schedule to find experiment data. These jobs run quickly and identify unique groups, the ID types present in the experiment, and the estimated number of users per group.

After the scan is complete, you can view and create experiments from the assignment source. The assignment data also populates the Experiment creation flow.

{% figure %}
![Assignment source scan results showing detected experiments](https://docs.statsig.com/images/statsig-warehouse-native/configuration/assignment-sources/87fac269-75bc-4a65-a660-339486605e24.png)
{% /figure %}

## Manage assignment sources

In the Assignment Source tab, you can see your Assignment sources and the experiments that use them.

{% figure %}
![Assignment Source Tab](https://docs.statsig.com/images/statsig-warehouse-native/configuration/assignment-sources/264100297-c41cd747-089c-4ccf-8b45-b70a1b4e264a.png)
{% /figure %}

## Example data

For experiment assignment sources, Statsig requires the following information: which users received an exposure, when, and to which experiment:

| Column Type            | Description                                                                               | Format/Rules                   |
| ---------------------- | ----------------------------------------------------------------------------------------- | ------------------------------ |
| timestamp              | **Required** an identifier of when the experiment exposure occurred                       | Castable to Timestamp/Date     |
| unit identifier        | **Required** at least one entity to which this metric belongs                             | Generally a user ID or similar |
| experiment identifier  | **Required** the experiment the exposure was for                                          | Usually an experiment name     |
| group identifier       | **Required** the experimental variant the user was assigned to                            | Usually a group name           |
| additional identifiers | *Optional* Entity identifiers for reuse across identifier types                           |                                |
| context columns        | *Optional* Fields you can use to group by and filter results in exploratory queries |                                |

For example, you could pull from exposure event logging directly:

| timestamp           | user\_id       | company\_id | experiment\_name  | group\_name | country |
| ------------------- | ------------- | ---------- | ---------------- | ---------- | ------- |
| 2023-10-10 00:01:01 | my\_user\_17503 | c\_22235455 | ranking\_v1\_vs\_v2 | v1         | US      |
| 2023-10-10 00:02:15 | my\_user\_18821 | c\_22235455 | ranking\_v1\_vs\_v2 | v2         | CA      |
| 2023-10-10 00:02:22 | my\_user\_18821 | c\_22235455 | search UI revamp | control    | CA      |
