Search code examples
sqldata-modelingdbt

DBT switch node path warnings to errors


is there a way to make these warnings in DBT errors?

[WARNING]: Did not find matching node for patch with name 'my_model' in the 'models' section of file 'models/path/to/model.yml'

We check errors at PR time, and I'd like to switch those to errors, so they can block merges into our repo.

We're trying to enforce more strictness in the model, so that we don't leave any unused path dangling in the model definition.


Solution

  • You can use the --warn-error option to raise errors on any warnings. From dbt --help:

    If dbt would normally warn, instead raise an exception. Examples include --models that selects nothing, deprecations, configurations with no associated models, invalid test configurations, and missing sources/refs in tests.

    So to use dbt build with this option, you would run:

    $ dbt --warn-error build