expect_table_row_count_to_equal

Feb 24, 2026

·

5

min read

Volume

·

dbt-expectations

·

Model,Seed,Source

How it Works

The expect_table_row_count_to_equal test from the dbt-expectations package asserts that a model, seed, or source contains exactly a specified number of rows. This is most commonly used with seed files or reference tables whose row count is known and fixed, such as lookup tables or currency lists.

Steps and Conditions

  1. Set Expected Count: Provide the exact expected row count using value.

  2. Optional Group By: Apply group_by to check counts within subgroups.

  3. Execution: The actual row count is computed and compared to the expected value.

  4. Outcome: Pass if counts match exactly; fail if they differ.

Example Usage: Reference Data

A data team maintains a currency_codes seed file that should always contain exactly 180 rows (one per ISO currency).

seeds:
  - name: currency_codes
    tests:
      - dbt_expectations.expect_table_row_count_to_equal:
          value: 180
seeds:
  - name: currency_codes
    tests:
      - dbt_expectations.expect_table_row_count_to_equal:
          value: 180
seeds:
  - name: currency_codes
    tests:
      - dbt_expectations.expect_table_row_count_to_equal:
          value: 180

Any accidental addition or deletion of rows in the seed file will be caught before deployment.

Interested to Learn More?
Try Out the Free 14-Days Trial

More Articles

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

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.