How it Works
The equality test from dbt-utils™ validates that two models contain exactly the same rows and columns. It performs a symmetric difference check — rows present in one model but not the other are reported as failures. This is commonly used to validate that a refactored model produces identical output to the original, or to confirm that two independently derived pipelines agree.
An optional compare_columns argument allows limiting the comparison to a specific subset of columns.
Steps and Conditions
Comparison Model: Specify the reference model using
compare_model.Optional Column Subset: Use
compare_columnsto compare only selected columns.Execution: A symmetric difference is computed between the two models.
Outcome: Pass if both models contain identical rows for the compared columns; fail if any discrepancies exist.
Example Usage: Model Refactoring
A data engineer is refactoring the revenue model and wants to confirm the new version produces identical output to the old one before deprecating it.
Any row-level difference between revenue_v2 and revenue_v1 surfaces a failure, providing confidence before the old model is retired.





