> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elementary-data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Anomaly Tests configuration params

> [card] [Generate your anomaly test with Elementary AI](https://elementary-data.com/community)
>
> Let our Slack chatbot create the anomaly test you need.

> [!TIP]
>
> 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`.

<pre>
  `All anomaly detection tests: -- timestamp_column: column name -- where_expression: sql expression -- anomaly_sensitivity: int -- anomaly_direction: [both | spike | drop] -- ignore_small_changes:
      spike_failure_percent_threshold: int
      drop_failure_percent_threshold: int -- anomaly_exclude_metrics: [SQL expression]Anomaly detection tests with timestamp_column: -- training_period: int
      period: [hour | day | week | month]
      count: int -- detection_period: int
      period: [hour | day | week | month]
      count: int -- exclude_detection_period_from_training: [true | false] -- time_bucket:
      period: [hour | day | week | month]
      count: int -- seasonality: day_of_week -- detection_delay:
      period: [hour | day | week | month]
      count: intdimension_anomalies, column_anomalies, all_columns_anomalies tests: -- dimensions: sql expressionvolume_anomalies test: -- fail_on_zero: [true | false]all_columns_anomalies test: -- column_anomalies: column monitors list -- exclude_prefix: string -- exclude_regexp: regexdimension_anomalies test: -- exclude_final_results: [SQL where expression on fields value / average]event_freshness_anomalies: -- event_timestamp_column: column name -- update_timestamp_column: column name`
</pre>

## Example configurations

```yml Models theme={null}
version: 2

models:
  - name: <model_name>
    config:
      elementary:
        timestamp_column: < model timestamp column >
    data_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
    data_tests: <here you will add elementary monitors as tests>
```

```yml Models example theme={null}
version: 2

models:
  - name: login_events
    config:
      elementary:
        timestamp_column: updated_at
    data_tests:
      - elementary.freshness_anomalies:
          config:
            tags: ["elementary"]
      - elementary.all_columns_anomalies:
          config:
            tags: ["elementary"]

  - name: users
    ## if no timestamp is configured, elementary will monitor without time filtering
    data_tests:
      - elementary.volume_anomalies:
          config:
            tags: ["elementary"]
```

```yml Sources theme={null}
version: 2

sources:
  - name: < some name >
    database: < database >
    schema: < schema >
    tables:
      - name: < table_name >
        config:
          elementary:
            timestamp_column: < source timestamp column >
        data_tests: <here you will add elementary monitors as tests>
```

```yml Sources example theme={null}
version: 2

sources:
  - name: "my_non_dbt_table"
    database: "raw_events"
    schema: "product"
    tables:
      - name: "raw_product_login_events"
        config:
          elementary:
            timestamp_column: "loaded_at"
        data_tests:
          - elementary.volume_anomalies
          - elementary.all_columns_anomalies:
              arguments:
                column_anomalies:
                  - null_count
                  - missing_count
                  - zero_count
        columns:
          - name: user_id
            data_tests:
              - elementary.column_anomalies
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.