Skip to main content

Assignment SQL

Assignment SQLs tell Eppo where to find a log of every time a subject (e.g., user) was enrolled into an experiment, the name of that experiment, and the variant that was assigned. Assignment SQLs can point to either logs from Eppo's SDK or from existing internal or third party randomization tools. You can also create multiple assignment sources if you use a combination of assignment methods.

Assignment SQLS can also include any properties by which you want to split results.

SELECT
ts_assigned,
experiment_name,
variant_name,
user_id,
-- optional properties that may be later used to split results
browser,
device_type
FROM mydb.myschema.assignments

In this example, user_id is assigned to experiment_name in the variant_name treatment group.

Creating an Assignment SQL

  1. Navigate to Definitions and click Create Definition SQL

Create Definition SQL

  1. Click Assignment SQL

Create Assignment SQL

  1. Select the subject (randomized unit) of the Assignment SQL. To learn more about specifying multiple randomization units Eppo, see the entities page.

Select user as entity

  1. Name your Assignment SQL

  2. Write SQL in the SQL editor to pull assignments from your data warehouse and click Run

At a minimum, this query should return a unique identifier for the subject (e.g., user_id), a unique identifier for the experiment, the variant the subject received, and a timestamp. You can also add optional subject properties such as browser or country.

If you do not yet have assignment logs in your warehouse, see the Event Logging page.

Write Assignment SQL Query

Then click Run, and the rows from that assignment table should appear in the bottom left.

  1. Annotate the columns that you've selected from the data warehouse

In case there's any ambiguity as to which properties the columns correspond to, we annotate them here.

Annotate assignment SQL columns

  1. Adding optional properties

Your feature flag tooling may have logged additional data about the user, like what country they're from or which browser they're using. You can annotate these additional properties here, and they will show up under the Entity Property SQL tab.

Add Assignment SQL Properties

  1. Click Save & Close