Skip to main content
When using a feature flag, variants are assigned to entities. Each such assignment is typically recorded somewhere in a data warehouse. Assignment tables in Confidence point to a table in your data warehouse that stores the assignments. Confidence provides this table if you’re using Confidence Flags. If you’re not using Confidence Flags, your internal or third-party feature flagging service provides the table. The only requirement for an assignment table in Confidence is that the underlying table has columns with information about when assignments happened, for whom, and where the assignment came from.

Structure

The assignment table in Confidence Flags has the following core structure:
assignment_timeunitflagrulevariantassignment_id
2023-05-20 00:04:25user5125flags/test-flagflags/test-flag/rules/rule123flags/test-flag/variants/controlcontrol
2023-05-20 05:01:21user7231flags/test-flagflags/test-flag/rules/rule123flags/test-flag/variants/treatmenttreatment
2023-05-20 23:13:53user3512flags/other-test-flagflags/other-test-flag/rules/rule123flags/other-test-flag/variants/treatmentcontrol
When creating an assignment table, you need to specify the columns that map to the following:
  • A timestamp column that records the time of the assignment. The assignment_time column in the example table.
  • One or more entity columns that hold the identifier of the entity the assignment happened for. The unit column in the example table.
  • An exposure key column to use to filter out the assignments that belong to the experiment. The rule column in the example table. You could also use the flag column if there is a 1-1 mapping of an experiment to a flag. Confidence represents an experiment as a rule on the flag.
  • A variant key column that identifies a specific variant. The assignment_id column in the example table. Use the assignment_id column and not the variant column as Confidence supports fall-through variants that allow multiple variants to be part of the same assignment.

Configuration

SQL Query

You need to input the SQL that selects your assignment rows. After you’ve entered your SQL you can click Run Query. Confidence then executes your query with a limit to check that everything is in order and show you some sample rows. You should write resource efficient queries. The result frequency of your experiment determines how often the queries run. For example, an experiment with hourly calculations runs the assignment table query once an hour. Here is a checklist of things to consider when writing the query for your assignment data:
  • ✅ Always have an index (also called Time partitioning in BigQuery) on the timestamp column to ensure that Confidence only queries the data within a partition, without this each query may require a full table scan.
  • ✅ If you can, also set up an index on the entity columns (also called Clustered Table in BigQuery), this helps improve the performance of the join that Confidence does between your exposures and facts.
  • ✅ If you can, perform heavy transformations in an upstream step and store the result in an intermediate table to avoid potentially redoing the transformations.
You have some placeholders at your disposal if you need to specify what partition you’re querying: {START_TIME} and {END_TIME}. These two parameters vary depending on the requirements of the metric that uses the assignment table. You don’t need to use them as Confidence always filters on your timestamp column, but sometimes your table format includes the date. These placeholders have the same Timestamp type as the timestamp column in your data warehouse.

Data Delivery Cadence

For configuring data delivery cadence, see the data delivery cadence page.

Timestamp Column

The timestamp column is the column that identifies the time that the assignment occurred. This column can either be a timestamp with a specific time point for the assignment, or you can select a date column. Selecting a date column means that any exposure calculation that includes the end of this day should include this assignment. It’s the same as specifying a time for the date that is at 23:59:59.

Entities

You need to specify the entity that this assignment is for. This has to be the same identifier that you use for the facts.

Exposure Key and Variant Key Columns

The exposure and variant keys must, at a given time, uniquely identify a single treatment group.
When using Confidence Flags:
  • exposure key is the name of the rule
  • the variant key is the assignment_id