is_not_orphaned

Rule: is_not_orphaned

Manifest Rule

is_not_orphaned details
This rule ensures that dbt objects (models, seeds, sources) are being referenced by other objects in your project. An object is considered "orphaned" if it has no child objects consuming it, or if it's only referenced by non-allowed object types.

An object is not orphaned if it is referenced by at least one allowed_references using:

{{ source("source_schema", "source_name") }}
{{ ref("model_name") }}

This helps identify unused or underutilized data assets that may be candidates for removal or refactoring.


Configuration

  • type: Must be is_not_orphaned.
  • allowed_references: (optional) List of object types that count as valid consumers of the checked objects.
    • Default: ["models"]
    • Options: models, snapshots, exposures, unit_tests
    • This indicates which objects count as val
  • applies_to: (optional) List of dbt object types to include.
    • Default: ["sources"]
    • Options: models, seeds, sources
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: "all_sources_cannot_be_orphaned"
    type: "is_not_orphaned"
    description: "All sources should be referenced by at least one model."

  - name: "models_and_sources_cannot_be_orphaned_except_marts"
    type: "is_not_orphaned"
    applies_to: ["models", "seeds"]
    excludes: ["models/marts/*"]
    allowed_references: ["models", "exposures"]
    severity: "warning"

  - name: "all_marts_are_exposed"
    type: "is_not_orphaned"
    description: "All mart models should be referenced by at least one exposure."
    applies_to: ["models"]
    includes: ["models/marts"]
    allowed_references: ["exposures"]
[[manifest_tests]]
name = "all_sources_cannot_be_orphaned"
type = "is_not_orphaned"
description = "All sources should be referenced by at least one model."

[[manifest_tests]]
name = "models_and_sources_cannot_be_orphaned_except_marts"
type = "is_not_orphaned"
applies_to = ["models", "seeds"]
excludes = ["models/marts/*"]
allowed_references = ["models", "exposures"]
severity = "warning"


[[manifest_tests]]
name = "all_marts_are_exposed"
type = "is_not_orphaned"
description = "All mart models should be referenced by at least one exposure."
applies_to = ["models"]
includes = ["models/marts"]
allowed_references = ["exposures"]
[[tool.dbtective.manifest_tests]]
name = "all_sources_cannot_be_orphaned"
type = "is_not_orphaned"
description = "All sources should be referenced by at least one model."

[[tool.dbtective.manifest_tests]]
name = "models_and_sources_cannot_be_orphaned_except_marts"
type = "is_not_orphaned"
applies_to = ["models", "seeds"]
excludes = ["models/marts/*"]
allowed_references = ["models", "exposures"]
severity = "warning"

[[tool.dbtective.manifest_tests]]
name = "all_marts_are_exposed"
type = "is_not_orphaned"
description = "All mart models should be referenced by at least one exposure."
applies_to = ["models"]
includes = ["models/marts"]
allowed_references = ["exposures"]
Relevant dbt code
{{ ref("your_model_name") }}
{{ source("source_schema", "your_source_name") }}