expect_table_column_count_to_be_between
dbt-expectations
·
Model,Seed,Source
·
Schema
How it Works
The expect_table_column_count_to_be_between test from the dbt-expectations package verifies that the number of columns in a table falls within a minimum and maximum range. This is a lightweight schema guard that detects unintentional column additions or removals without requiring an exact column list.
Steps and Conditions
Define Range: Set
min_valueand/ormax_valuefor the acceptable column count.Execution: The actual column count is retrieved from schema metadata.
Outcome: Pass if the count is within range; fail if it falls outside.
Example Usage: Data Lake
A data lake team processes semi-structured data where the column count is expected to stay between 10 and 30. Wild deviations suggest a schema explosion or collapse in the source.
A column count outside this range triggers investigation into upstream schema changes.

