Skip to content

Commit

Permalink
Update warnings.md
Browse files Browse the repository at this point in the history
update versions
  • Loading branch information
mirnawong1 authored May 3, 2024
1 parent a42a5ba commit 65f657c
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions website/docs/reference/global-configs/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ dbt --warn-error run

</File>

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.
<VersionBlock lastVersion="1.7">

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

</VersionBlock>

<VersionBlock firstVersion="1.8">

Use the `silence` parameter to ignore warnings through project flags, without needing to re-specify the silence list every time.
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.

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.
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/or `warn` 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 `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. When `error` is set to `"all"` or `"*"`, the optional `warn` 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 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'>
Expand All @@ -47,10 +57,13 @@ flags:
</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.
:::

<VersionBlock lastVersion="1.7">

```text
dbt --warn-error-options '{"include": "all"}' run
...
Expand All @@ -72,7 +85,7 @@ DBT_WARN_ERROR_OPTIONS='{"include": ["NoNodesForSelectionCriteria"]}' dbt run
...
```

<VersionBlock lastVersion="1.7">


<File name='profiles.yml'>

Expand All @@ -90,6 +103,27 @@ config:

<VersionBlock firstVersion="1.8">

```text
dbt --warn-error-options '{"error": "all"}' run
...
```

```text
dbt --warn-error-options '{"error": "all", "warn": ["NoNodesForSelectionCriteria"]}' run
...
```


```text
dbt --warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}' run
...
```

```text
DBT_WARN_ERROR_OPTIONS='{"error": ["NoNodesForSelectionCriteria"]}' dbt run
...
```

<File name='profiles.yml'>

```yaml
Expand Down

0 comments on commit 65f657c

Please sign in to comment.