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 columns:
ColumnTypeDescription
assignment_timeTimestampWhen the assignment was applied.
resolve_idStringUnique identifier for the resolve request.
targeting_keyStringThe identifier of the entity that was assigned.
targeting_key_selectorStringThe type of entity targeted (for example, user_id).
flagStringThe flag that was resolved.
ruleStringThe rule that matched. Null for fall-through assignments.
variantStringThe variant assigned. Only set for regular assignments, not fall-through.
assignment_idStringIdentifier for the treatment group. Used as the variant key when configuring an experiment.
clientStringThe identifier for the client.
client_credentialStringThe identifier for the client credential.
segmentStringThe segment that matched. Only set for regular assignments.
default_assignment_reasonStringReason for the default assignment (for example, flag archived or no matching rule).
Here is an example of what the data in an assignment table looks like:
assignment_timeresolve_idtargeting_keytargeting_key_selectorflagrulevariantassignment_idclientclient_credentialsegmentdefault_assignment_reason
2023-05-20 00:04:25abc-123user5125user_idflags/test-flagflags/test-flag/rules/rule1flags/test-flag/variants/controlcontrolclients/web-appclients/web-app/clientCredentials/prod-keysegments/us-users
2023-05-20 05:01:21def-456user7231user_idflags/test-flagflags/test-flag/rules/rule1flags/test-flag/variants/treatmenttreatmentclients/web-appclients/web-app/clientCredentials/prod-keysegments/us-users
2023-05-21 10:22:01jkl-012user8844user_idflags/other-flagclients/ios-appclients/ios-app/clientCredentials/mobile-keyFLAG_ARCHIVED
A single resolve request can produce multiple rows. Each applied flag produces one row, and each fall-through assignment on that flag produces an additional row.
When configuring 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.
  • One or more entity columns that hold the identifier of the entity the assignment happened for. The targeting_key column.
  • An exposure key column to use to filter out the assignments that belong to the experiment. The rule column. 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. 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