expect_column_values_to_match_like_pattern

Feb 24, 2026

·

5

min read

Values format

·

dbt-expectations

·

Column

How it Works

The expect_column_values_to_match_like_pattern test from the dbt-expectations package validates that all values in a column match a given SQL LIKE pattern. This is a simple but effective way to enforce string format conventions without needing full regex syntax.

Steps and Conditions

  1. Column Selection: Identify the column to check.

  2. Define Pattern: Provide the SQL LIKE pattern using like_pattern.

  3. Optional Row Condition: Scope the check using row_condition.

  4. Execution: Each value is compared against the LIKE pattern.

  5. Outcome: Pass if all values match; fail if any do not.

Example Usage: Data Warehouse

An analytics team stores internal project codes that must always begin with a two-letter department prefix followed by a dash.

models:
  - name: project_budget
    columns:
      - name: project_code
        tests:
          - dbt_expectations.expect_column_values_to_match_like_pattern:
              like_pattern: "__-%"
models:
  - name: project_budget
    columns:
      - name: project_code
        tests:
          - dbt_expectations.expect_column_values_to_match_like_pattern:
              like_pattern: "__-%"
models:
  - name: project_budget
    columns:
      - name: project_code
        tests:
          - dbt_expectations.expect_column_values_to_match_like_pattern:
              like_pattern: "__-%"

This ensures all project codes follow the expected naming convention, catching any codes that deviate from the standard format.

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.