expect_table_row_count_to_equal_other_table
How it Works
The expect_table_row_count_to_equal_other_table test from the dbt-expectations package validates that two models contain exactly the same number of rows. This is the dbt-expectations equivalent of equal_rowcount from dbt-utils™, providing a cross-table volume consistency check.
Steps and Conditions
- Comparison Model: Specify the reference model using
compare_model. - Execution: Both models are counted and compared.
- Outcome: Pass if counts are equal; fail if they differ.
Example Usage: ETL Validation
A data team wants to confirm that their transformation layer preserves exactly the same number of records as the source, ruling out any dropped or duplicated rows.
models:
- name: stg_transactions
tests:
- dbt_expectations.expect_table_row_count_to_equal_other_table:
compare_model: source('raw', 'transactions')Any row count discrepancy between staging and source immediately surfaces for investigation.
Interested to Learn More? Try Out the Free 14-Days Trial
One AI-native workspace to build, ship, and monitor dbt™ — without the tool sprawl.
Join industry leaders winning with DinoAI agents
Data engineers and analysts at the most AI-native startups and enterprises use Paradime's DinoAI agents everyday to become market leaders.