Anomaly detection tests configuration
The anomaly detection tests configuration is defined in .yml
files in your dbt project, just like in native dbt tests.
The configuration of Elementary is dbt native and follows the same priorities and inheritance. The more granular and specific configuration overrides the less granular one.
Elementary searches and prioritizes configuration in the following order:
For models tests:
- Test arguments.
- Tests path configuration under
tests
key indbt_project.yml
. - Model configuration.
- Path configuration under
models
key indbt_project.yml
. - Global vars in
dbt_project.yml
.
For sources tests:
- Test arguments.
- Tests path configuration under
tests
key indbt_project.yml
. - Table configuration.
- Source configuration.
- Global vars in
dbt_project.yml
.
Tests configuration params
If your data set has a timestamp column that represents the creation time of a
field, it is highly recommended configuring it as a timestamp_column
.
Params by test
Params by [core concept](/guides/how-anomaly-detection-works)
All anomaly detection tests:
— timestamp_column: column name
— where_expression: sql expression
— anomaly_sensitivity: int
— min_training_set_size: int
— anomaly_direction: [both | spike | drop]
Anomaly detection tests with timestamp_column:
— days_back: int
— backfill_days: int
— time_bucket:
period: [hour | day | week | month]
count: int
— seasonality: day_of_week
all_columns_anomalies test:
— column_anomalies: column monitors list
— exclude_prefix: string
— exclude_regexp: regex
dimension_anomalies test:
— dimensions: sql expression
event_freshness_anomalies:
— event_timestamp_column: column name
— update_timestamp_column: column name
Example configurations
version: 2
models:
- name: <model_name>
config:
elementary:
timestamp_column: < model timestamp column >
tests: < here you will add elementary monitors as tests >
- name: <your model with no timestamp>
## if no timestamp is configured, elementary will monitor without time filtering
tests: <here you will add elementary monitors as tests>