expect_column_pair_values_to_be_in_set
dbt-expectations
·
Model,Seed,Source
·
Values set, Columns relationship
How it Works
The expect_column_pair_values_to_be_in_set test from the dbt-expectations package validates that for every row, the combination of values from two columns is a member of an explicitly defined set of allowed pairs. This is useful for enforcing business rules where certain column value combinations are valid while others are not.
Steps and Conditions
Column Pair: Specify the two columns using
column_Aandcolumn_B.Define Allowed Pairs: List the acceptable value combinations using
value_pairs_set.Optional Row Condition: Filter rows using
row_condition.Execution: Each row's column pair is checked against the allowed set.
Outcome: Pass if all pairs are in the allowed set; fail if any invalid combination exists.
Example Usage: Product Configuration
A product configuration model should only allow specific combinations of product_tier and billing_cycle that the pricing team has approved.
This prevents invalid tier-billing combinations from entering the system, protecting pricing integrity.

