dbt Tests

expect_table_row_count_to_equal_other_table

dbt-expectations

·

Model,Seed,Source

·

Volume, Tables relationship

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

  1. Comparison Model: Specify the reference model using compare_model.

  2. Execution: Both models are counted and compared.

  3. 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'

models:
  - name: stg_transactions
    tests:
      - dbt_expectations.expect_table_row_count_to_equal_other_table:
          compare_model: source('raw', 'transactions'

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

Stop Managing Pipelines. Start Shipping Them.

Join the teams that replaced manual dbt™ workflows with agentic AI. Free to start, no credit card required.

Stop Managing Pipelines. Start Shipping Them.

Join the teams that replaced manual dbt™ workflows with agentic AI. Free to start, no credit card required.

Stop Managing Pipelines. Start Shipping Them.

Join the teams that replaced manual dbt™ workflows with agentic AI. Free to start, no credit card required.

Copyright © 2026 Paradime Labs, Inc. Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.

Copyright © 2026 Paradime Labs, Inc. Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.

Copyright © 2026 Paradime Labs, Inc. Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.