dbt Tests

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

  1. Define Range: Set min_value and/or max_value for the acceptable column count.

  2. Execution: The actual column count is retrieved from schema metadata.

  3. 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.

models:
  - name: raw_events
    tests:
      - dbt_expectations.expect_table_column_count_to_be_between:
          min_value: 10
          max_value: 30
models:
  - name: raw_events
    tests:
      - dbt_expectations.expect_table_column_count_to_be_between:
          min_value: 10
          max_value: 30
models:
  - name: raw_events
    tests:
      - dbt_expectations.expect_table_column_count_to_be_between:
          min_value: 10
          max_value: 30

A column count outside this range triggers investigation into upstream schema changes.

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.