Skip to main content

Assignment SQL

When you write an Assignment SQL, you're defining which entities will be assigned to which experiment and variation, and at what time.

You can optionally include any dimensions that you want to be able to slice/dice the analysis by.

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 of the Assignment SQL

Select user as entity

Entities are the randomization units of your experiment. By default, entities in Eppo are User, but you can also create your own customized entities and attach Assignment SQL's to them.

  1. Name your Assignment SQL

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

Recall tht you should have an assignment table in your data warehouse with certain column types.

In this step, you're going to write SQL to pull that data.

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. Make note of your feature flag name and variant names

Note the value of the FEATURE FLAG column; in this example it's new_user_onboarding - this is your feature flag name.

Note the values of the VARIANT column; in this example it's control and treatment - these are the names of your variants.

You will need these names later.

  1. Adding optional dimensions

Add Assignment SQL Dimensions

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 dimensions here, and they will show up under the Dimension SQL tab.

  1. Click Save & Close