dbt Tests

expect_table_row_count_to_be_between

dbt-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
models:
  - name: daily_orders
    tests:
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 5000
          max_value: 50000
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

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.