> ## 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.

# all_columns_anomalies

<Card title="Generate your anomaly test with Elementary AI" icon="wand-magic-sparkles" horizontal="true" href="https://elementary-data.com/community">
  Let our Slack chatbot create the anomaly test you need.
</Card>

`elementary.all_columns_anomalies`

Executes column level monitors and anomaly detection on all the columns of the table.
Specific monitors are detailed in the table below and can be configured using the `columns_anomalies` configuration.

The test checks the data type of each column and only executes monitors that are relevant to it.
You can use `column_anomalies` param to override the default monitors, and `exclude_prefix` / `exclude_regexp` to exclude columns from the test.

**Default monitors by type:**

| Data quality metric  | Column Type |
| -------------------- | ----------- |
| `null_count`         | any         |
| `null_percent`       | any         |
| `min_length`         | string      |
| `max_length`         | string      |
| `average_length`     | string      |
| `missing_count`      | string      |
| `missing_percent`    | string      |
| `min`                | numeric     |
| `max`                | numeric     |
| `average`            | numeric     |
| `zero_count`         | numeric     |
| `zero_percent`       | numeric     |
| `standard_deviation` | numeric     |
| `variance`           | numeric     |

**Opt-in monitors by type:**

| Data quality metric | Column Type |
| ------------------- | ----------- |
| `sum`               | numeric     |

### Test configuration

No mandatory configuration, however it is highly recommended to configure a `timestamp_column`.

<pre>
  <code>
    data\_tests:
      -- elementary.all\_columns\_anomalies:
        arguments:
          <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/column-anomalies"><font color="#CD7D55">column\_anomalies: column monitors list</font></a>
          <a href="/data-tests/anomaly-detection-configuration/dimensions"><font color="#CD7D55">dimensions: sql expression</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>
          <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/detection-period"><font color="#CD7D55">detection\_period:</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/training-period"><font color="#CD7D55">training\_period:</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/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>
          <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>
  </code>
</pre>

<RequestExample>
  ```yml Models theme={null}
  models:
    - name: < model name >
      config:
        elementary:
          timestamp_column: < timestamp column >
      data_tests:
        - elementary.all_columns_anomalies:
            arguments:
              column_anomalies: < specific monitors, all if null >
              where_expression: < sql expression >
              time_bucket: # Daily by default
                period: < time period >
                count: < number of periods >
  ```

  ```yml Models example theme={null}
  models:
    - name: login_events
      config:
        elementary:
          timestamp_column: "loaded_at"
      data_tests:
        - elementary.all_columns_anomalies:
            config:
              tags: ["elementary"]
            arguments:
              where_expression: "event_type in ('event_1', 'event_2') and country_name != 'unwanted country'"
              time_bucket:
                period: day
                count: 1
              
              # optional - change global sensitivity
              anomaly_sensitivity: 3.5
  ```
</RequestExample>
