expect_table_row_count_to_be_between

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

How it Works

The expect_table_row_count_to_be_between test from the dbt-expectations package validates that the total number of rows in a model, seed, or source falls within a defined minimum and maximum. This is a fundamental volume check to catch unexpected data loss or explosive data growth that could indicate pipeline issues.

Optional group_by and row_condition arguments allow more targeted checks within data subsets.

Steps and Conditions

  1. Define Range: Set min_value and/or max_value for acceptable row counts.
  2. Optional Config: Apply group_by and row_condition as needed.
  3. Execution: The row count is computed and compared to the range.
  4. Outcome: Pass if the count is within range; fail if it falls outside.

Example Usage: E-commerce

An e-commerce platform loads daily orders and expects between 5,000 and 50,000 rows per day under normal operating conditions.

models:
  - name: daily_orders
    tests:
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 5000
          max_value: 50000

A row count outside this range flags either a data load failure or an abnormal spike in orders requiring 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.