github dbt-labs/dbt-project-evaluator v2.0.0

4 hours ago

dbt-project-evaluator 2.0.0: native dbt checks

dbt-project-evaluator 2.0.0 runs the same dbt Labs best practices (28 rules in six categories: modeling, testing, documentation, structure, performance and governance) as native dbt checks instead of models built in your warehouse.

It requires dbt 2.0 or later. If you are on dbt v1, stay on dbt-project-evaluator 1.x (the 1.x branch).

What you get

  • Native. Run the rules with dbt check, list them with dbt ls --resource-type check, and set their severity, tags or whether they run in dbt_project.yml.
  • Checked before every build. Checks run before anything compiles on dbt build, so a rule set to severity: error stops a build that breaks it.
  • Fast. On a project of about 1,900 models, all the checks take about 15 seconds, parsing included, against about 2 minutes for the 1.x dbt build on Snowflake.
  • Selectable. dbt check --select and state:modified report only the violations on the resources you changed, which is what a pull request needs.
  • No warehouse needed. No credentials, no compute cost, the same result on every adapter supported by dbt 2, and CI that doesn't need secrets.

Upgrading from 1.x

# packages.yml
packages:
  - package: dbt-labs/dbt_project_evaluator
    version: [">=2.0.0", "<3.0.0"]

Convert your exceptions seed with the script that ships with the package:

python dbt_packages/dbt_project_evaluator/scripts/migrate_to_v2.py

See the migration guide for the full list of steps.

Breaking changes

  • dbt >= 2.0.0 only.
  • Nothing is built in the warehouse. The package no longer creates models or seeds and doesn't need dbt_utils. The models:, seeds: and dispatch: configuration of the package is gone, and so are the DAG tables such as int_all_dag_relationships. To query your DAG, use the information schema, for example dbt show --inline "select * from {{ info_schema('edges') }}".
  • Severity is set with checks: in dbt_project.yml, per category or per check, instead of the tests severity and the DBT_PROJECT_EVALUATOR_SEVERITY environment variable. The print_dbt_project_evaluator_issues on-run-end hook is gone.
  • Exceptions are a var or a macro. The dbt_project_evaluator_exceptions seed is replaced by the var (or macro) of the same name. An entry can also match on a column of the check, for example a parent or a pair, or be declared as a SQL condition next to the resources.
  • Hard-coded references are reported by dbt lint (rule DBT05) and not by the package anymore.
  • Removed variables: insert_batch_size, max_depth_dag, comment_chars, token_costs and use_native_agate_printing.

Other differences

  • Disabled resources are ignored by all the checks.
  • Sources are identified by their unique_id: two sources with the same name in different packages are two resources.
  • exclude_paths_from_project is a case-sensitive substring match rather than a regular expression, and applies to the resources of all packages.
  • fct_documentation_coverage and fct_test_coverage only return a row when the coverage is below the target, and ignore exceptions.
  • fct_undocumented_sources and fct_duplicate_sources return one row per source.
  • fct_direct_join_to_source, fct_multiple_sources_joined, fct_model_fanout and fct_source_fanout return the names of the parents or children in a list column, not their number.

Known limitations

  • dbt check --select can't scope source rows yet (dbt-labs/dbt#16554), so the checks about sources report nothing when you pass a selector. Run them without --select.
  • fct_missing_primary_key_tests doesn't count not_null constraints yet (dbt-labs/dbt#16553).
  • dbt check prints the first 5 rows of each check. scripts/show_violations.py lists all of them.
  • The package ships three agent skills. Until ai_provider is set (for example flags: {ai_provider: claude} in dbt_project.yml), dbt 2 prints an AiProviderUnset warning and installs none of them.

Don't miss a new dbt-project-evaluator release

NewReleases is sending notifications on new releases.