expect_table_row_count_to_equal

Feb 23, 2026dbt-expectations · Model,Seed,Source · Volume

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

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

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.