expect_column_pair_values_to_be_equal
Feb 24, 2026
·
5
min read
Columns relationship
·
dbt-expectations
·
Model,Seed,Source
How it Works
The expect_column_pair_values_to_be_equal test from the dbt-expectations package verifies that for every row in a model, the value of one column equals the value of another. This is useful for validating denormalized copies of data, enforcing business rules where two fields must stay in sync, or detecting drift between calculated and stored values.
An optional row_condition can scope the check to relevant rows.
Steps and Conditions
Column Pair: Specify the two columns to compare using
column_Aandcolumn_B.Optional Row Condition: Filter rows before comparison.
Execution: Each row's values for the two columns are compared.
Outcome: Pass if all compared values are equal; fail if any differ.
Example Usage: Accounting System
An accounting system stores both a calculated_tax column and a posted_tax column. These should always be equal for finalized transactions.
Any discrepancy between calculated and posted tax values on finalized records will trigger the test to fail.





