Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update warnings.md #5434

Merged
merged 21 commits into from
May 9, 2024
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions website/docs/reference/global-configs/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,41 @@ dbt --warn-error run
```
</File>

<VersionBlock firstVersion="1.4">

Converting any and all 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 `include` and/or `exclude` parameters. Warning names can be found in [dbt-core's types.py file](https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/events/types.py), where each class name that inherits from `WarnLevel` corresponds to a warning name (e.g. `AdapterDeprecationWarning`, `NoNodesForSelectionCriteria`).

The `include` parameter can set to `"all"` or `"*"` to treat all warnings as exceptions, or to a list of specific warning names to treat as exceptions. When include is set to `"all"` or `"*"`, the optional `exclude` parameter can be set to exclude specifc warnings from being treated as exceptions.
The `include` 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. When include is set to `"all"` or `"*"`, the optional `exclude` parameter can be set to exclude specific warnings from being treated as exceptions.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

<VersionBlock firstVersion="1.8">

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 the `silence` 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.


<File name='dbt_project.yml'>

```yaml
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
- TestsConfigDeprecation
- NoNodesForSelectionCriteria
```
</File>

</VersionBlock>

:::info `WARN_ERROR` and `WARN_ERROR_OPTIONS` are mutually exclusive
`WARN_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.
`WARN_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.
:::

```text
Expand All @@ -47,16 +72,34 @@ DBT_WARN_ERROR_OPTIONS='{"include": ["NoNodesForSelectionCriteria"]}' dbt run
...
```

<VersionBlock lastVersion="1.7">

<File name='profiles.yml'>

runleonarun marked this conversation as resolved.
Show resolved Hide resolved
```yaml
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

config:
warn_error_options:
include: all
exclude:
- NoNodesForSelectionCriteria
```
</File>

</VersionBlock>

<VersionBlock firstVersion="1.8">

<File name='profiles.yml'>

```yaml
config:
warn_error_options:
error: # Previously called "include"
warn: # Previously called "exclude"
- NoNodesForSelectionCriteria
silence: # Silence or ignore warnings
- TestsConfigDeprecation
- NoNodesForSelectionCriteria
```
</File>

Expand Down
Loading