Skip to content

Model Contracts Warn Error - Can't (work out) how to Configure with Warn Error Options #261

@alittlesliceoftom

Description

@alittlesliceoftom

Context:
I want to raise all warnings as error, except the model contracts error, but it's either not possible, or I can't work out how.

dbt-labs/dbt-core#7213 specifies the origination history of this error in v1.5.

{% macro <adapter>__create_table_as(...) %}
  {% set contract_config = config.get('contract') %}
  {% if contract_config.enforced %}
     {{exceptions.warn("Model contracts cannot be enforced by <adapter>!")}}
  {% endif %}
{% endmacro %}

When I read the docs on warn error options, I find that I should specify warning options via this list:
https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/events/types.py

But I can't find any type matching the exceptions.warn.

Suspect the answer may be obvious to someone more familiar with this part of the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions