Data Lineage Explorer
Paste SQL or dbt models: table lineage graph, column lineage and upstream/downstream of any field.
How it works
Paste SQL (CREATE VIEW/TABLE AS SELECT, INSERT … SELECT, MERGE, UPDATE, CTEs, JOINs, UNION) or dbt models with {{ ref() }} and {{ source() }}. A built-in tokenizer and parser derives table-level lineage and column-level lineage for direct references and aliases, marks expressions as derived or aggregated, and traces everything upstream and downstream of a chosen table or column.
- dbt Jinja is resolved first: {{ ref("m") }} → m, {{ ref("pkg","m") }} → m, {{ source("s","t") }} → s.t, {{ this }} → the current model, {{ config(materialized=…) }} is read; other Jinja is stripped with a note.
- A hand-written tokenizer handles quoted identifiers ("x", `x`, [x]), strings, comments, dollar-quoting and operators; statements are split at top-level semicolons.
- A recursive-descent parser understands WITH/CTEs (column lists, RECURSIVE), SELECT lists with aliases, FROM/JOIN … ON/USING, comma joins, derived tables, scalar/EXISTS/IN subqueries, UNION/INTERSECT/EXCEPT, SELECT */t.* (incl. EXCEPT/EXCLUDE), CREATE … AS, INSERT … SELECT (positional mapping to the column list or known DDL), MERGE (UPDATE SET / INSERT VALUES) and UPDATE … SET … FROM.
- Each output column is resolved through CTEs and subqueries to base-table columns. A bare column reference is "direct" (or "renamed" when aliased); anything else is "derived", "aggregate" if it uses an aggregate function, or "constant" without column inputs. Columns used only in JOIN/WHERE/GROUP BY are listed as filter columns of the statement.
- Unqualified columns are resolved against the tables in scope using known columns (from CREATE TABLE DDL or earlier statements); if several tables could supply a column it is attributed to all and flagged as ambiguous.
- Upstream/downstream tracing is a breadth-first walk over column edges (or table edges for a table focus) across all statements; the reported transform is the strongest transformation along the path.
- Not supported: dynamic SQL, stored procedures, PIVOT/UNPIVOT column lineage, column lineage of table functions (UNNEST/FLATTEN/LATERAL VIEW), Jinja loops and macros, and SELECT * from tables whose columns are unknown (kept as a "*" star edge).
Sources
- dbt: ref function (dbt Labs)
- dbt: source function (dbt Labs)
- PostgreSQL: SELECT (WITH, FROM, JOIN, set operations) (PostgreSQL Global Development Group)
- PostgreSQL: MERGE (PostgreSQL Global Development Group)
- OpenLineage column-level lineage facet (transformation types) (OpenLineage)
Use this tool in an app
These free programs for your browser have this tool built in, next to everything else the task needs.
-
Opsdeck Developer & ops workbench
One deck for CI failures, cron, traces, k8s events, API diffs, query plans and Terraform.
Related tools
- CI/CD Failure Explorer – Paste CI logs from several runs: root cause per run, grouped signatures, top causes and fixes.
How to use the Data Lineage Explorer
Paste SQL or dbt models and trace any table or column upstream to its sources or downstream to everything that breaks if it changes.
What it is for
"Where does this revenue number come from?" and "If I rename users.plan, what breaks?" are the two lineage questions every data team keeps asking. Answering them by reading SQL means following aliases through CTEs, joins, views and dbt ref() calls across many files. That is slow and easy to get wrong.
Paste your SQL or dbt models and the tool parses them with its own tokenizer and parser. It handles CREATE VIEW/TABLE AS SELECT, INSERT … SELECT, MERGE, UPDATE, CTEs, joins, subqueries and set operations. It builds table-level lineage and column-level lineage, and labels each output column as direct, renamed, derived, aggregate or constant. Then it traces upstream, downstream or both from the table or column you pick. Mark dbt models with -- model: name.
It analyses SQL text, not your warehouse. Dynamic SQL, stored procedures, PIVOT, table functions like UNNEST/FLATTEN, Jinja loops and macros aren't followed. SELECT * from a table whose columns it never saw stays a "*" edge.
Worked example
The first built-in example contains four dbt models — stg_orders, stg_customers, fct_orders, rpt_revenue_by_country — plus a MERGE into analytics.dim_customer. The focus is rpt_revenue_by_country.revenue.
5 statements: 3 source tables feed 5 model/reports via 7 table edges; 22 output columns traced (6 derived/aggregated). rpt_revenue_by_country.revenue ← finance.fx_rates.rate_to_eur, shop.orders.amount_cents; 0 downstream columns.
The upstream trace:
| Node | Depth | Transform |
|---|---|---|
| fct_orders.amount_eur | 1 | aggregate |
| finance.fx_rates.rate_to_eur | 2 | aggregate |
| stg_orders.amount | 2 | aggregate |
| shop.orders.amount_cents | 3 | aggregate |
So revenue is the sum of amount_cents / 100.0 converted with fx_rates.rate_to_eur. If a currency is missing from fx_rates, the coalesce(…, 1) in fct_orders silently treats it as EUR. That is worth knowing before anyone trusts the report. The tool also lists filter columns: stg_orders.status (only paid orders count) shapes revenue without flowing into it.
The second example works in the other direction. It asks for everything downstream of raw.users.plan and finds mart.daily_active.plan (depth 1) and mart.plan_kpis.plan (depth 2), both direct copies.
How to read the result
- Statements — each parsed statement with its kind, target, source tables and the columns used only in JOIN/WHERE/GROUP BY.
- Tables — sources (never written to) vs models, with upstream and downstream neighbours.
- Column lineage — for every output column, the expression, the base-table source columns and the transform type.
∪in an expression means the column is fed by several branches of a UNION. - Focus trace — the breadth-first walk from your table or column. The transform shown is the strongest one on the path, so "aggregate" anywhere upstream marks the whole chain.
- Notes and errors — stripped Jinja, ambiguous unqualified columns, generated names like
_colN.
Tips and common mistakes
- Include the
CREATE TABLEDDL for raw tables when queries use unqualified columns. Otherwise a column that two joined tables could supply is attributed to both and flagged as ambiguous. - Alias every expression. Unaliased ones get positional names (
_col3), which change when someone reorders the SELECT. - For impact analysis, trace downstream from the source column. Tracing upstream from a report only shows where it comes from, not who else depends on it.
- Filter columns matter. Changing a WHERE column (like
status) changes the numbers even though it never shows up in the column lineage. - Paste all related models in one go. Lineage only crosses model boundaries that are in the input.
FAQ
Does it understand dbt?
Yes for {{ ref() }}, {{ source() }}, {{ this }} and {{ config(materialized=…) }}. Other Jinja, including macros and loops, is stripped with a note.
Which SQL dialect does it parse?
A broad PostgreSQL-style dialect with common extensions: quoted identifiers in "x", ` x and [x], dollar-quoting, SELECT * EXCEPT/EXCLUDE`, MERGE and UPDATE … FROM.
What is the difference between "derived" and "aggregate"?
Derived means a row-level expression such as amount_cents / 100.0 or CAST(ts AS date). Aggregate means an aggregate function such as SUM or COUNT is involved, so one output value summarises many input rows.
Is my SQL sent anywhere?
The parsing is done by the tool's own code. No database connection is made and no queries are executed.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://datalineageexplorer.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://datalineageexplorer.usefulweb.site/mcp· tool namedata_lineage_explorer
Example request
curl -s -X POST https://datalineageexplorer.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{…see OpenAPI examples…}'