tags

Note: To tag a model, use the tag configuration.

models/schema.yml
version: 2
models:
- name: model_name
# tags: [] # this is not supported — check out the above link for more info
columns:
- name: column_name
tags: [<string>]
tests:
<test-name>:
tags: [<string>]

Definition

The tags property can be used to:

  • set tags for a column
  • set tags on a specific test
  • set tags for a source or source table.

These tags can be used as part of the resource selection syntax.

Note that you need to use the tag configuration to apply tags to models, seeds, and snapshots. (Yes, we know this is confusing, and hope to resolve it in a future release!)

Changelog

Examples

Tag a column and test

models:
- name: users
columns:
- name: email
# Add a "pii" tag to this column, and all associated tests
tags:
- pii
tests:
- unique
- name: account_id
tests:
- relationships:
to: ref("accounts")
field: id
# Add a "foreign-key" tag to this test
tags:
- foreign-key

Then, use the tag: selector to run the tests on a particular column.

$ dbt test --models tag:pii