> ## Documentation Index
> Fetch the complete documentation index at: https://elementary-ele-2784-fix-alerts-configuration-links-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Anomaly Tests configuration params

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

{/* prettier-ignore */}

<pre>
  <code>
    All anomaly detection tests:
    \-- <a href="/data-tests/anomaly-detection-configuration/timestamp-column"><font color="#CD7D55">timestamp\_column: column name</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/where-expression"><font color="#CD7D55">where\_expression: sql expression</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/anomaly-sensitivity"><font color="#CD7D55">anomaly\_sensitivity: int</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/anomaly-direction"><font color="#CD7D55">anomaly\_direction: \[both | spike | drop]</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/ignore_small_changes"><font color="#CD7D55">ignore\_small\_changes:</font></a>
        <a href="/data-tests/anomaly-detection-configuration/ignore_small_changes"><font color="#CD7D55">spike\_failure\_percent\_threshold: int</font></a>
        <a href="/data-tests/anomaly-detection-configuration/ignore_small_changes"><font color="#CD7D55">drop\_failure\_percent\_threshold: int</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/anomaly-exclude-metrics"><font color="#CD7D55">anomaly\_exclude\_metrics: \[SQL expression]</font></a>

    Anomaly detection tests with timestamp\_column:
    \-- <a href="/data-tests/anomaly-detection-configuration/training-period"><font color="#CD7D55">training\_period: int</font></a>
        <a href="/data-tests/anomaly-detection-configuration/training-period"><font color="#CD7D55">period: \[hour | day | week | month]</font></a>
        <a href="/data-tests/anomaly-detection-configuration/training-period"><font color="#CD7D55">count: int</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/detection-period"><font color="#CD7D55">detection\_period: int</font></a>
        <a href="/data-tests/anomaly-detection-configuration/detection-period"><font color="#CD7D55">period: \[hour | day | week | month]</font></a>
        <a href="/data-tests/anomaly-detection-configuration/detection-period"><font color="#CD7D55">count: int</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/time-bucket"><font color="#CD7D55">time\_bucket:</font></a>
        <a href="/data-tests/anomaly-detection-configuration/time-bucket"><font color="#CD7D55">period: \[hour | day | week | month]</font></a>
        <a href="/data-tests/anomaly-detection-configuration/time-bucket"><font color="#CD7D55">count: int</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/seasonality"><font color="#CD7D55">seasonality: day\_of\_week</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/detection-delay"><font color="#CD7D55">detection\_delay:</font></a>
        <a href="/data-tests/anomaly-detection-configuration/detection-delay"><font color="#CD7D55">period: \[hour | day | week | month]</font></a>
        <a href="/data-tests/anomaly-detection-configuration/detection-delay"><font color="#CD7D55">count: int</font></a>

    volume\_anomalies test:
    \-- <a href="/data-tests/anomaly-detection-configuration/fail_on_zero"><font color="#CD7D55">fail\_on\_zero: \[true | false]</font></a>

    all\_columns\_anomalies test:
    \-- <a href="/data-tests/anomaly-detection-configuration/column-anomalies"><font color="#CD7D55">column\_anomalies: column monitors list</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/exclude_prefix"><font color="#CD7D55">exclude\_prefix: string</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/exclude_regexp"><font color="#CD7D55">exclude\_regexp: regex</font></a>

    dimension\_anomalies test:
    \-- <a href="/data-tests/anomaly-detection-configuration/dimensions"><font color="#CD7D55">dimensions: sql expression</font></a>

    event\_freshness\_anomalies:
    \-- <a href="/data-tests/anomaly-detection-configuration/event_timestamp_column"><font color="#CD7D55">event\_timestamp\_column: column name</font></a>
    \-- <a href="/data-tests/anomaly-detection-configuration/update_timestamp_column"><font color="#CD7D55">update\_timestamp\_column: column name</font></a>
  </code>
</pre>

## Example configurations

<CodeGroup>
  ```yml properties.yml
  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>
  ```

  ```yml Example
  version: 2

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

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

  ```yml sources_properties.yml
  sources:
    - name: < some name >
      database: < database >
      schema: < schema >
      tables:
        - name: < table_name >
          ## sources don't have config, so elementary config is placed under 'meta'
          meta:
            elementary:
              timestamp_column: < source timestamp column >
          tests: <here you will add elementary monitors as tests>
  ```

  ```yml Example
  sources:
    - name: "my_non_dbt_table"
      database: "raw_events"
      schema: "product"
      tables:
        - name: "raw_product_login_events"
          ## sources don't have config, so elementary config is placed under 'meta'
          meta:
            elementary:
              timestamp_column: "loaded_at"
          tests:
            - elementary.volume_anomalies
            - elementary.all_columns_anomalies:
                column_anomalies:
                  - null_count
                  - missing_count
                  - zero_count
          columns:
            - name: user_id
              tests:
                - elementary.column_anomalies
  ```
</CodeGroup>
