expect_select_column_values_to_be_unique_within_record
Feb 24, 2026
·
5
min read
Uniqueness
·
dbt-expectations
·
Model,Seed,Source
How it Works
The expect_select_column_values_to_be_unique_within_record test from the dbt-expectations package validates that for each row, the values across a specified set of columns are all distinct from each other. This is useful when multiple columns hold ranked or ordered values that should never be duplicates within the same row (e.g., first, second, and third choice selections).
An ignore_row_if argument handles rows where some columns may be null.
Steps and Conditions
Column List: Define the columns to check within each row.
Null Handling: Configure
ignore_row_ifas needed.Execution: Each row is checked to see if the values across the listed columns are all unique.
Outcome: Pass if values are unique within each row; fail if any row has duplicate values across columns.
Example Usage: Survey Platform
A survey platform asks respondents to rank their top three preferred products. Each rank position should hold a different product ID.
This prevents a respondent from accidentally ranking the same product in multiple positions.





