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

# Alert configuration in code

<Note>
  Most alert settings can be managed directly in the Elementary Cloud UI — no code changes needed. Code configuration is useful when you want settings version-controlled or need to apply them in bulk across many assets.
</Note>

You can enrich and route alerts by adding properties to your models, sources, and tests in `.yml` files.

Elementary prioritizes configuration in the following order:

**For models / sources:**

1. Model config block
2. Model properties
3. Model path configuration under `models` key in `dbt_project.yml`

**For tests:**

1. Test properties
2. Tests path configuration under `tests` key in `dbt_project.yml`
3. Parent model configuration

## Owners

An owner is the person responsible for the model or test. Owners are tagged in alerts and shown throughout the UI.

Owners can also be added or edited directly in the [Catalog](/cloud/features/collaboration-and-communication/catalog).

Elementary enriches alerts with [owners for models or tests](https://docs.getdbt.com/reference/resource-configs/meta#designate-a-model-owner)).

* If you want the owner to be tagged on slack use '@' and the email prefix of the slack user (@jessica.jones to tag [jessica.jones@marvel.com](mailto:jessica.jones@marvel.com)).
* You can configure a single owner or a list of owners (`["@jessica.jones", "@joe.joseph"]`).

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          owner: "@jessica.jones"
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          owner: ["@jessica.jones", "@joe.joseph"]
  ```

  ```yml test/model config block theme={null}
  {{ config(
      tags=["Tag1","Tag2"]
      meta={
          "description": "This is a description",
          "owner": "@jessica.jones"
      }
  ) }}
  ```

  ```yml dbt_project.yml theme={null}
  models/sources:
    path:
      subfolder:
        +meta:
          owner: "@jessica.jones"

  data_tests:
    path:
      subfolder:
        +meta:
          owner: "@jessica.jones"

  # table level:

  sources:
    - name: source_name
      database: db
      schema: schema
      tables:
        - name: orders
          meta:
            owner: "@jessica.jones"


  ```
</CodeGroup>

## Subscribers

Subscribers are additional users who should be notified on alerts for a model or test, beyond the owner.

If you want additional users besides the owner to be tagged on an alert, add them as subscribers.

* If you want the subscriber to be tagged on slack use '@' and the email prefix of the slack user (@jessica.jones to tag [jessica.jones@marvel.com](mailto:jessica.jones@marvel.com)).
* You can configure a single subscriber or a list (`["@jessica.jones", "@joe.joseph"]`).

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          subscribers: "@jessica.jones"
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          subscribers: ["@jessica.jones", "@joe.joseph"]
  ```

  ```yml test/model config block theme={null}
  {{ config(
      meta={
          "subscribers": "@jessica.jones"
      }
  ) }}
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        +meta:
          subscribers: "@jessica.jones"

  data_tests:
    path:
      subfolder:
        +meta:
          subscribers: "@jessica.jones"
  ```
</CodeGroup>

## Description

Elementary supports configuring description for tests that are included in alerts.
It's recommended to add an explanation of what does it mean if this test fails, so alert will include this context.

<CodeGroup>
  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          description: "This is the test description"
  ```

  ```yml test config block theme={null}
  {{ config(
      tags=["Tag1","Tag2"]
      meta={
          description: "This is the test description"
      }
  ) }}
  ```

  ```yml dbt_project.yml theme={null}
  data_tests:
    path:
      subfolder:
        +meta:
          description: "This is the test description"
  ```
</CodeGroup>

## Tags

You can use [tags](https://docs.getdbt.com/reference/resource-configs/tags) to provide context to your alerts.

* You can tag a group or a channel in a slack alert by adding `#channel_name` as a tag.
* Tags are aggregated,so a test alert will include both the test and the parent model tags.

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      tags: ["#marketing", "#data_ops"]
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      tags: ["#marketing", "#data_ops"]
  ```

  ```yml test/model config block theme={null}
  {{ config(
      tags=["#marketing", "#data_ops"]
      }
  ) }}
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        tags: ["#marketing", "#data_ops"]

  data_tests:
    path:
      subfolder:
        tags: ["#marketing", "#data_ops"]
  ```
</CodeGroup>

## Alert distribution

### Custom channel

Route alerts for a specific model or test to a dedicated Slack channel. You must always configure a default fallback channel in your integration settings.

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          channel: data_ops
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          channel: data_ops
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        +meta:
          channel: data_ops

  data_tests:
    path:
      subfolder:
        +meta:
          channel: data_ops
  ```
</CodeGroup>

### Suppression interval

Prevent repeated alerts for the same ongoing issue. Set a snooze period in hours — Elementary won't send new alerts on the same issue within that window.

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          alert_suppression_interval: 24
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          alert_suppression_interval: 12
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        +meta:
          alert_suppression_interval: 24

  data_tests:
    path:
      subfolder:
        +meta:
          alert_suppression_interval: 48
  ```
</CodeGroup>

### Group alerts by table

By default, Elementary sends one alert per failure. You can instead group all failures for a table into a single notification. Grouped alerts include a union of owners, tags, and subscribers but contain less detail per issue.

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          slack_group_alerts_by: table
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          slack_group_alerts_by: table
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        +meta:
          slack_group_alerts_by: table

  data_tests:
    path:
      subfolder:
        +meta:
          slack_group_alerts_by: table
  ```
</CodeGroup>

### Alert fields

<Warning>Currently supported for test alerts only.</Warning>

Control which fields appear in the alert. All fields are included by default.

Supported fields: `table`, `column`, `description`, `owners`, `tags`, `subscribers`, `result_message`, `test_parameters`, `test_query`, `test_results_sample`

<CodeGroup>
  ```yml model theme={null}
  models:
    - name: my_model_name
      config:
        meta:
          alert_fields: ["description", "owners", "tags", "subscribers"]
  ```

  ```yml test theme={null}
  data_tests:
    - not_null:
      config:
        meta:
          alert_fields: ["description", "owners", "tags", "subscribers"]
  ```

  ```yml dbt_project.yml theme={null}
  models:
    path:
      subfolder:
        +meta:
          alert_fields: ["description", "owners", "tags", "subscribers"]

  data_tests:
    path:
      subfolder:
        +meta:
          alert_fields: ["description", "owners", "tags", "subscribers"]
  ```
</CodeGroup>
