expect_column_values_to_be_of_type

Feb 24, 2026

·

5

min read

Schema

·

dbt-expectations

·

Column

How it Works

The expect_column_values_to_be_of_type test from the dbt-expectations package validates that a column's data type exactly matches the expected type. This is particularly important when integrating with downstream tools or APIs that require strict type contracts, or when validating that transformations haven't accidentally changed a column's type.

Steps and Conditions

  1. Column Selection: Identify the column to evaluate.

  2. Expected Type: Specify the exact data type using column_type.

  3. Execution: The actual column type is retrieved from the database metadata and compared.

  4. Outcome: Pass if the type matches; fail if it differs.

Example Usage: Analytics Engineering

An analytics engineer wants to ensure that the event_timestamp column in the web_events model always remains a TIMESTAMP type and hasn't been accidentally cast to VARCHAR during a refactor.

models:
  - name: web_events
    columns:
      - name: event_timestamp
        tests:
          - dbt_expectations.expect_column_values_to_be_of_type:
              column_type

models:
  - name: web_events
    columns:
      - name: event_timestamp
        tests:
          - dbt_expectations.expect_column_values_to_be_of_type:
              column_type

models:
  - name: web_events
    columns:
      - name: event_timestamp
        tests:
          - dbt_expectations.expect_column_values_to_be_of_type:
              column_type

If the column type changes, the test fails and prevents type-related issues from propagating to dashboards or ML pipelines.

Interested to Learn More?
Try Out the Free 14-Days Trial

More Articles

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

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.