Warnings
Turning on the WARN_ERROR
config will convert dbt warnings into errors. Any time dbt would normally warn, it will instead raise an error. Examples include --select
criteria that selects no resources, deprecations, configurations with no associated models, invalid test configurations, or tests and freshness checks that are configured to return warnings.
dbt --warn-error run
...
Converting any warnings to errors may suit your needs perfectly, but there may be some warnings you just don't care about, and some you care about a lot. The WARN_ERROR_OPTIONS
config gives you more granular control over exactly which types of warnings are treated as errors.
-
Warnings that should be treated as errors can be specified through
error
and/orwarn
parameters. Warning names can be found in dbt-core's types.py file, where each class name that inherits fromWarnLevel
corresponds to a warning name (e.g.AdapterDeprecationWarning
,NoNodesForSelectionCriteria
). -
The
error
parameter can be set to"all"
or"*"
to treat all warnings as exceptions, or to a list of specific warning names to treat as exceptions. Whenerror
is set to"all"
or"*"
, the optionalwarn
parameter can be set to exclude specific warnings from being treated as exceptions. -
Use the
silence
parameter to ignore warnings through project flags, without needing to re-specify the silence list every time. For example, to silence deprecation warnings or certain warnings you want to ignore across your project, you can specify them in thesilence
parameter. This is useful in large projects where certain warnings aren't critical and can be ignored to keep the noise low and logs clean.
name: "my_dbt_project"
tests:
+enabled: True
flags:
warn_error_options:
error: # Previously called "include"
warn: # Previously called "exclude"
silence: # To silence or ignore warnings
- NoNodesForSelectionCriteria
WARN_ERROR
and WARN_ERROR_OPTIONS
are mutually exclusiveWARN_ERROR
and WARN_ERROR_OPTIONS
are mutually exclusive. You can only specify one, even when you're specifying the config in multiple places (e.g. env var + CLI flag), otherwise, you'll see a usage error.
dbt --warn-error-options '{"error": "all"}' run
...
dbt --warn-error-options '{"error": "all", "warn": ["NoNodesForSelectionCriteria"]}' run
...
dbt --warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}' run
...
DBT_WARN_ERROR_OPTIONS='{"error": ["NoNodesForSelectionCriteria"]}' dbt run
...
config:
warn_error_options:
error: # Previously called "include"
warn: # Previously called "exclude"
- NoNodesForSelectionCriteria
silence: # Silence or ignore warnings
- NoNodesForSelectionCriteria