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
Define Range: Set
min_valueand/ormax_valuefor acceptable row counts.Optional Config: Apply
group_byandrow_conditionas needed.Execution: The row count is computed and compared to the range.
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.
A row count outside this range flags either a data load failure or an abnormal spike in orders requiring investigation.

