unique_combination_of_columns

Feb 24, 2026

·

5

min read

Uniqueness

·

dbt-utils

·

Model

How it Works

The unique_combination_of_columns test from dbt-utils™ validates that the combination of values across a specified set of columns is unique for every row. Unlike the native unique test (which operates on a single column), this test handles composite keys where multiple columns together define a unique record.

An optional quote_columns argument handles column names that are reserved words.

Steps and Conditions

  1. Column Combination: Define the columns that together must be unique.

  2. Execution: All row combinations are checked for duplicates.

  3. Outcome: Pass if no duplicate combinations exist; fail if any duplicates are found.

Example Usage: Analytics Model

A marketing analytics model tracks conversions by campaign_id and user_id. Each combination of campaign and user should appear only once.

models:
  - name: campaign_conversions
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns

models:
  - name: campaign_conversions
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns

models:
  - name: campaign_conversions
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns

Duplicate campaign-user combinations would inflate conversion counts in reports, making this a critical data quality gate.

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.