has_tags

Rule: has_tags


has_tags details
This rule ensures that dbt objects (model, seed, source, macro, etc.) contain tags specified in the configuration. It can be configured to "all", "any" or "one_of" (maximum one) tags from a specified list.

Configuration

  • type: Must be has_tags.
  • applies_to: (optional) List of dbt object types to include.
    • Default: ["models", "seeds", "snapshots", "analyses", "sources", "exposures"]
    • Options: models, seeds, snapshots, analyses, sources, exposures
  • tags: List of tags to check for.
  • criteria: Criteria for tag presence.
    • Options:
      • all: All specified tags must be present.
      • any: At least one of the specified tags must be present.
      • one_of: Exactly one of the specified tags must be present.
    • Default: all
Common Rule Config
  • name: Human-readable name of the rule.
  • severity: "error" (fail) or "warning" (warn only).
    • (optional, defaults to "error" if not specified)
  • description: Human-readable explanation of the rule.
  • category: Override the default rule category. Included in structured output (JSON, CSV, NDJSON) but not in the CLI table. Each rule has a built-in default (e.g. documentation, naming, testing, governance, structure, performance).
    • (optional, defaults to the rule type's built-in category)
  • includes: List of patterns to explicitly include for this rule. See Includes & Excludes for pattern syntax and examples.
  • excludes: List of patterns to explicitly exclude from this rule. See Includes & Excludes for pattern syntax and examples.
  • model_materializations: Filter models by materialization type. Only applies when applies_to includes models.
    • (optional, if not specified all materializations are included)
    • Built-in types: table, view, incremental, ephemeral, materialized_view. Custom materializations are also supported.
    • Example: ["table", "incremental"]

Example Config

manifest_tests:
  - name: "everything_has_tags"
    type: "has_tags"
    required_tags: ["tag1", "tag2", "tag3"]
    criteria: "all"  # options: "all", "any", "one_of"
    description: "Everything must have tags."
    # severity: "warning"  (optional)
    # applies_to: ['models', 'seeds']  (optional)
    # includes: ["path/to/include/*"]
    # excludes: ["path/to/exclude/*"]
[[manifest_tests]]
name = "everything_has_tags"
type = "has_tags"
required_tags = ["tag1", "tag2", "tag3"]
criteria = "all"  # options: "all", "any", "one_of"
description = "Everything must have tags."
# severity = "warning"  # (optional)
# applies_to = ["models", "seeds"]  # (optional)
# includes = ["path/to/include/*"]
# excludes = ["path/to/exclude/*"]
[[tool.dbtective.manifest_tests]]
name = "everything_has_tags"
type = "has_tags"
required_tags = ["tag1", "tag2", "tag3"]
criteria = "all"  # options: "all", "any", "one_of"
description = "Everything must have tags."
# severity = "warning"  # (optional)
# applies_to = ["models", "seeds"]  # (optional)
# includes = ["path/to/include/*"]
# excludes = ["path/to/exclude/*"]
Relevant dbt code
models:
  - name: model_with_tags
    # Either in config block
    config:
        tags:
          - tag1
          - tag2
    # Or directly as a property
    tags: ["tag1", "tag2"]
  - name: model_without_tags