Metacenta

Lineage integrity · rule deep-lineage

Deep dbt lineage: long chains of models

A Metacenta review checks this under the rule Lineage depth stays workable. Everything below applies whether or not you ever commission one.

What this rule checks

This rule flags dbt models more than 8 hops from a root. A model that reads sources directly sits 1 hop from a root, and each model in between adds one. We count the longest path, whatever each model's materialisation. Models inside a dependency cycle have no depth; the cycle rule reports them instead.

Why it matters

Long chains make failures slow to diagnose, because each step has to be traced by hand. They also make every rebuild expensive.

How to fix it

Flatten the deepest lineage chains. Flatten the intermediate layers. Fold models that only rename, filter or pass columns through into the model they feed, starting with the deepest chain.

When it is fine to leave

A project with deliberate layers can pass 8 hops honestly, for instance staging, several intermediate steps, marts and a final aggregate. If each hop does distinct work and carries its own tests, leave it and record why. We rate the finding low severity.

What we need to check it

manifest.json alone. The threshold is a review setting, 8 hops by default, and each finding states the value used.

Published rules it corresponds to

dbt_project_evaluator, rule fct_chained_views_dependencies. Ours checks the same concern, tested differently. dbt Labs' rule is specifically about chains of view and ephemeral models, as a build-time performance concern; this one measures lineage depth regardless of materialization.

This means our check corresponds to their rule. It does not mean the publisher reviewed or endorses it.