Skip to content

Commit 273ac06

Browse files
authored
Merge pull request #2120 from elementary-data/fix-volume-threshold-severity-example
Fix volume_threshold severity example and document warn/error behavior
2 parents 5546b68 + 1cb1104 commit 273ac06

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

docs/data-tests/volume-threshold.mdx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ models:
7777
tags: ["elementary"]
7878
```
7979
80-
```yml Custom thresholds
80+
```yml Custom thresholds - drop only
8181
models:
8282
- name: critical_transactions
8383
data_tests:
@@ -89,7 +89,6 @@ models:
8989
direction: drop
9090
config:
9191
tags: ["elementary"]
92-
severity: error
9392
```
9493
9594
```yml With time bucket and filter
@@ -144,6 +143,23 @@ models:
144143
| Configuration | Explicit thresholds | Sensitivity tuning |
145144
| Baseline | Previous bucket | Training period average |
146145

146+
### How severity levels work
147+
148+
This test has built-in dual severity using dbt's `warn_if` / `error_if` config. You do **not** need to set `config.severity` yourself. The behavior is:
149+
150+
- Change exceeds `warn_threshold_percent` but not `error_threshold_percent` → **dbt warning**
151+
- Change exceeds `error_threshold_percent` → **dbt error** (test fails)
152+
- Change is below `warn_threshold_percent` → **pass**
153+
154+
For example, with `warn_threshold_percent: 3` and `error_threshold_percent: 8`:
155+
- A 2% drop → pass
156+
- A 5% drop → warning
157+
- A 10% drop → error
158+
159+
<Warning>
160+
Do not set `config.severity: error` on this test. That would override the built-in dual severity and turn all warnings into errors, defeating the purpose of having separate thresholds.
161+
</Warning>
162+
147163
### Notes
148164

149165
- The `warn_threshold_percent` must be less than or equal to `error_threshold_percent`

0 commit comments

Comments
 (0)