<@U088WCP3B4P> can you generate a volume_anomalies...
# ask-elementary-ai
a
@kapa.ai can you generate a volume_anomalies tests for a particular model where the time bucket is 6 hours days, days_back are 7 , backfill days 2, sensitive 3 and the timestamp column is named as event_time
k
A message from kapa.ai
Here’s a
volume_anomalies
test configuration matching your requirements (6‑hour buckets,
days_back: 7
,
backfill_days: 2
, sensitivity 3,
event_time
timestamp):
Copy code
yaml models:   - name: your_model_name     tests:       - elementary.volume_anomalies:           timestamp_column: event_time           anomaly_sensitivity: 3           # 6-hour time buckets           time_bucket:             period: hour             count: 6           # Historical range & backfill behavior           days_back: 7           backfill_days: 2
This follows the documented
volume_anomalies
test pattern and time bucket configuration, using
hour
as the period with
count: 6
to get 6‑hour buckets, and
timestamp_column
so the anomaly logic works on time buckets rather than whole-table counts.[\[volume anomalies\]](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies)[\[time bucket\]](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/time-bucket)
a
@kapa.ai The params still the same if I'm using the the package version 0.20.0, because a similar config is raising the error below
Copy code
Database Error in test elementary_volume_anomalies_d_model_2__7__3_0__hour__6__event_time Unrecognized name: metric_type; Did you mean metric_name? at [39:17]
k
A message from kapa.ai
The parameters you’re using (
timestamp_column
,
time_bucket
,
days_back
, etc.) are still valid in recent versions – the
metric_type
error is not caused by your test config itself.
Unrecognized name: metric_type; Did you mean metric_name?
indicates that your Elementary warehouse tables are on an older schema that doesn’t include the new
metric_type
column, while the 0.16+ package code expects it. This is the same class of issue reported for 0.16.0 and fixed by rebuilding the Elementary models in the warehouse.[\[GitHub issue 1671\]](https://github.com/elementary-data/elementary/issues/1671)[\[Slack metric_type fix\]](https://elementary-community.slack.com/archives/C02CTC89LAX/p1725442048153789) From the community fix: > “You may need to recreate the elementary tables by running the command > `dbt run --select elementary --full-refresh`”[\[Slack metric_type fix\]](https://elementary-community.slack.com/archives/C02CTC89LAX/p1725442048153789) What to do: 1. Make sure you’ve upgraded the
elementary
dbt package to 0.20.0 and run
dbt deps
. 2. Recreate Elementary’s models/tables with a full refresh:
Copy code
bash    dbt run --select elementary --full-refresh
3. Then rerun your tests:
Copy code
bash    dbt test --select your_model_name
Your 6‑hour
volume_anomalies
config with
timestamp_column: event_time
is conceptually fine; the error is about the underlying Elementary schema being out of sync with the package version, not about the parameters themselves. The docs for
volume_anomalies
and anomaly params remain aligned with what you’re using.[\[volume_anomalies config\]](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies#test-configuration)[\[anomaly params\]](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/anomaly-params)