---
title: "Long chains of SQL tables built on tables | Metacenta"
description: "For SQL projects without dbt: how we measure how far a table sits from its raw data. The threshold we flag at, and when a long chain is earned."
url: "https://metacenta.com/rules/sql-deep-lineage"
updated: "2026-10-14"
tokens: 487
---

Lineage integrity · rule sql-deep-lineage

# Long chains of SQL tables built on tables

A Metacenta review checks this under the rule **SQL lineage stays shallow**. Everything below applies whether or not you ever commission one.

## What this rule checks

For SQL projects without dbt, this rule flags relations more than 8 steps downstream of anything loaded from outside. A relation built only from tables no project file writes sits at 0, and each project-built relation in between adds one. We count the longest path.

## Why it matters

A change at the top of the chain has to be traced through every step before anyone knows what it breaks.

## How to fix it

**Shorten the deepest SQL lineage chains.** Collapse intermediate steps that only rename or filter into the step they feed, starting with the deepest chain.

## When it is fine to leave

A chain where every step does distinct work, and each has its own assertions, can pass 8 steps honestly. Leave it, and record why in the files. We rate the finding low severity.

## What we need to check it

The `.sql` files, read from your repository with read-only access or uploaded. We rebuild the lineage from statements and folder layout without running the SQL. The threshold is a review setting, 8 by default.

[Ask about a review](https://metacenta.com/enquire?src=rule-sql-deep-lineage&via=md)

## Related pages

- [dbt dependency cycles in the model DAG](https://metacenta.com/rules/dependency-cycle)
- [dbt models with a hardcoded table name](https://metacenta.com/rules/hardcoded-table-reference)
- [dbt exposures: what they are and how to declare them](https://metacenta.com/rules/model-possibly-unused)
- [Deep dbt lineage: long chains of models](https://metacenta.com/rules/deep-lineage)
- [A sample review, as a client reads it](https://metacenta.com/sample)
- [All published rules](https://metacenta.com/rules)
- [How a review is assessed](https://metacenta.com/standard)
