Implementation

To learn how to implement experiments with Winning Variant, read more about the Variant API.

Manage through Snowflake

Roles

A user must be assigned of the following application roles to execute any of the examples described on this page:

  • admin
  • editor
  • scientist

Get assignments

To get assignments for a given subject, perform a select against the assignments table:

USE <application_name>;

SELECT variant_id
  FROM core.assignments
  WHERE subject_id = '<subject_id>' AND experiment_id = '<experiment_id>';

Get or make assignments

Gets an assignment or makes one if it doesn’t exist:

USE <application_name>;

SELECT experimentation.create_assignment('<subject_type>', '<subject_id>', '<experiment_id>');

Returns the new or existing variant assigned.

Examples

USE <application_name>;

-- Get or make an assignment for user `user_0001` in the `home-cta` experiment
SELECT experimentation.create_assignment('customer_id', 'user_0001', 'home-cta');