# dbt-labs/dbt-utils

Utility functions for dbt projects.

Repository: https://github.com/dbt-labs/dbt-utils
Canonical: https://ross.abutalabs.com/products/dbt-utils
Homepage: https://hub.getdbt.com/dbt-labs/dbt_utils/latest/
Language: Makefile
License: Apache-2.0
License Family: permissive
Last push: 2026-07-07T20:45:03+00:00

## Health v2 (maintenance only)
Score: 92/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 90, longevity 100
- inputs: {"age_days": 3335, "days_push": 57, "days_rel": 66, "gap_med": 21.5, "n_releases_24m": 9}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1792, forks 628 (observed 2026-08-28T04:05:37.119583+00:00)

## What it is
dbt-utils is an official dbt package providing reusable Jinja macros and generic data tests for dbt projects. It includes SQL generators (date spine, pivot, surrogate keys), introspective macros, and schema tests like equality, recency, and uniqueness checks.

## Use cases
- add reusable data quality tests to my dbt project
- generate a date spine table in SQL
- pivot and unpivot columns in a warehouse
- generate surrogate keys in dbt models
- union multiple relations with different columns
- deduplicate rows in a dbt model
- check row counts match between two tables

## When to choose
- you use dbt and want battle-tested macros instead of writing your own
- you need common generic tests like recency, equality, or not-null proportion
- you want portable SQL helpers that work across warehouses

## When to avoid
- you don't use dbt for data transformation
- you need highly custom logic not covered by the provided macros
- your project requires dbt versions outside the supported range

## Facets
- artifact type: library
- maturity: stable
- function: testing, developer-tools, etl, data-science
- domain: analytics, developer-tools, databases
- platform: python, cli, cross-platform
- tags: dbt, sql-macros, analytics-engineering, data-quality-tests, jinja, sql-generators, package-hub, data-engineering

## Member repositories
- dbt-labs/dbt-utils (main) score 92

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:37.119583+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:22:57.814876+00:00, confidence not recorded.
  - readme: https://github.com/dbt-labs/dbt-utils (fetched 2026-08-28T04:05:37.119583+00:00, sha 481bde74f3e2)
  - homepage: https://hub.getdbt.com/dbt-labs/dbt_utils/latest/ (fetched 2026-08-29T11:01:56.583374+00:00, sha d26b04b2893a)
  - site_page: https://docs.getdbt.com/docs/building-a-dbt-project/package-management (fetched 2026-08-29T11:01:56.585973+00:00, sha 1ef4e5227932)
  - site_page: https://docs.getdbt.com/guides/fusion-package-compat (fetched 2026-08-29T11:01:56.589148+00:00, sha f4db30365c03)
  - site_page: https://docs.getdbt.com/docs/package-management (fetched 2026-08-29T11:01:56.591580+00:00, sha 1ef4e5227932)
  - site_page: https://www.getdbt.com/dbt-labs/about-us (fetched 2026-08-29T11:01:56.596099+00:00, sha 26494b1195ab)
  - site_page: https://www.getdbt.com/ (fetched 2026-08-29T11:01:56.594274+00:00, sha c7654b34b0de)
- Data as of 2026-08-30T08:39:29.467469+00:00.
