If you dropped the orders table tonight, which dashboards would break tomorrow, and who would notice first? Most data teams can answer that for the tables they built last month. The table someone built three years ago is harder.
Data lineage is the record that answers that question. It maps where each dataset comes from and what it feeds, so that a change, an incident or a cleanup starts from facts. Without it, every one of those starts with someone asking around.
This guide shows how to build data lineage that is useful in practice. It covers where lineage comes from, how to build it at table level from dbt, Snowflake and BigQuery, how to add the dashboards, models and applications that read the data, when column-level lineage is worth it, and how to use lineage for impact analysis and incidents. It includes the queries, a script, a worked example and the gaps to watch for.
The short answer
Data lineage is the map of where each dataset comes from and what depends on it. Build it from three places: the transformation code, which describes how tables are built; the warehouse’s query history, which records what actually read and wrote each table; and the tools that read the data, such as dashboards, models and applications. Start at table level and add column-level lineage where renames, sensitive data or metric definitions need it. Use the result to check the impact of a change before making it, to trace an incident to its cause and its readers, and to rank datasets by what they feed.
Book a free call if you want help mapping lineage on your own data estate.
Key terms
Upstream: the sources a dataset is built from, directly or through other tables.
Downstream: everything built from a dataset or reading it, including tables, dashboards, models and applications.
Table-level lineage: which tables feed which tables.
Column-level lineage: which columns feed which columns, through every transformation.
Exposure: in dbt, a declared consumer of data outside the project, such as a dashboard or a model.
Impact analysis: finding everything downstream of a dataset before changing or removing it.
The method at a glance
Pull table-level lineage from your transformation code, such as dbt’s manifest.
Add lineage from the warehouse’s query history to catch work that runs outside the code.
Declare the dashboards, models and applications that read the data.
Join the pieces into one graph you can query.
Add column-level lineage where renames, sensitive data or metric definitions need it.
Use the graph for impact analysis before changes and for tracing incidents.
Find and close the gaps, and refresh the graph on a schedule.
Why does data lineage matter?
Lineage turns questions that take a meeting into questions that take a query.
Changing a table safely. Before renaming a column or changing a definition, lineage lists every table, dashboard and model that reads it, and the owner of each.
Tracing an incident. When a number is wrong, lineage shows which upstream tables could have caused it and which downstream readers need to be told.
Ranking what matters. A table’s importance comes from what it feeds. How to decide which datasets your business depends on uses lineage to pass the tier of a destination, such as the invoice run, up to every table it is built from.
Retiring work safely. A table with nothing downstream and no readers is a candidate for retirement. How to find and retire unused data pipelines depends on that check.
Where does lineage come from?
No single source sees everything. Each of the three main sources fills a different gap.
Transformation code
Tools such as dbt know how every model is built, because each model declares what it reads. This is the cleanest lineage you will get, and it exists before anything runs. Its limit is that it only covers what lives in the project. Scripts, notebooks, scheduled queries and manual fixes outside dbt do not appear.
Warehouse query history
The warehouse records every query that reads or writes a table, whatever tool sent it. That catches the work outside the code. Its limits are that it only sees what has run recently, it needs parsing to turn queries into links, and some warehouses keep the history for a limited time.
The tools that read the data
Dashboards, reverse ETL syncs, models and applications are the destinations that make a table matter. Warehouse history shows that a BI service account read a table. It does not say which dashboard, who looks at it, or what decision it supports. That has to come from the tools themselves or be declared by hand.
How do you build table-level lineage?
From dbt
Every dbt run writes a manifest.json file with a parent_map and a child_map, which list the direct parents and children of every model, source and exposure. The child_map alone answers the downstream question. This script lists everything downstream of one model, skipping tests:
For a quick answer without a script, dbt ls accepts the same selectors as dbt build and does not connect to the warehouse. A plus sign after a model selects everything downstream of it:
From Snowflake
Snowflake’s ACCESS_HISTORY view records, for each query, the base objects it read in base_objects_accessed and the objects it wrote in objects_modified. Joining the two gives a link from every table read to every table written by the same query. The view needs Enterprise Edition or higher, keeps a year of history and can lag by up to three hours.
Views do not move data, so they do not appear in objects_modified. The OBJECT_DEPENDENCIES view covers them, recording which objects each view references. It deliberately leaves out CREATE TABLE AS SELECT, INSERT and MERGE, because those move data, so the two views complement each other.
Snowflake also shows lineage in Snowsight, on the Lineage tab of a table or view in the catalog, covering both data movement and object dependencies. It needs Enterprise Edition and the VIEW LINEAGE privilege, which is granted to PUBLIC by default, and it keeps lineage for a year. It does not track data moved through separate, disjointed queries, including through stored procedures, or tables used only for joins and filters.
From BigQuery
The INFORMATION_SCHEMA.JOBS view records, for each job, the tables it referenced and the destination table it wrote, for the past 180 days. The same join works there:
The last filter drops the temporary tables BigQuery creates to hold query results. Google also offers managed data lineage in Knowledge Catalog, the product formerly called Dataplex Universal Catalog. It records lineage automatically for copy jobs, loads from Cloud Storage, CREATE TABLE AS SELECT and DML, once the Data Lineage API is enabled on the project. It keeps lineage for 30 days and is billed for processing and metadata storage, and recurring loads from the BigQuery Data Transfer Service are not captured automatically.
How do you store lineage so you can query it?
The outputs above are lists of links. Load them into one table, with a column that records where each link came from, and the whole graph becomes something any analyst can query:
Keeping the source on each link shows which parts of the graph come from code, which from history and which were entered by hand. A link that appears in the history but not in dbt points at work outside the project. A link that has not been seen for months points at a job that may have stopped.
With the edges in a table, a recursive query lists everything downstream of a table, with the number of steps to each one. Both Snowflake and BigQuery support recursive common table expressions:
The depth limit stops the query if the graph contains a loop, which can happen when a table is rebuilt from its own previous version. Swap the direction of the join to walk upstream instead.
How do you add what the data feeds?
The destinations are the easiest part to leave out, and the part that gives lineage its value. A graph that stops at the last table cannot tell you that fct_orders feeds the invoice run.
In dbt, exposures declare the consumers of the data. Each exposure has a type, which can be a dashboard, notebook, analysis, ml model or application, a list of the models it depends on, and an owner. Once declared, exposures appear in the manifest’s child_map, so the downstream script above includes them.
Start with the destinations that carry the most consequence: anything that bills customers, reports to finance or regulators, or runs a customer-facing product. A handful of exposures for those covers the Tier 1 decisions. Dashboards can follow, starting with the ones that are viewed most, which most BI tools can list.
For destinations outside dbt’s view, record the service account each tool uses. Every read by that account in the warehouse history then becomes a known destination, even if the specific report has to be looked up in the tool.
When do you need column-level lineage?
Table-level lineage answers most questions. Column-level lineage is worth the extra effort in three situations, each of which needs to know which specific column a change or a value flows into:
Renames and type changes. Renaming one column of a wide table affects only the readers of that column. Column-level lineage lists them, so the change does not stall waiting for every reader of the table to check.
Sensitive data. Tracing where a personal data column flows shows every table and destination that now holds it.
Metric definitions. When two dashboards disagree on revenue, column-level lineage shows whether they read the same column through the same logic.
Column-level lineage is harder to keep accurate, because it depends on parsing SQL. dbt offers column-level lineage in its Catalog on Enterprise plans, built by parsing each model’s SQL, and it follows the columns in each select statement but not the columns used only in joins and filters. Snowflake records column lineage in ACCESS_HISTORY and shows it in Snowsight. Google’s managed lineage collects it for top-level BigQuery columns, with limits on nested fields and very large jobs. Use these where they exist before building your own parser.
How do you use lineage for impact analysis?
Make a lineage check part of every change to a Tier 1 or Tier 2 model. The check takes minutes and catches the changes that would otherwise surface as a wrong number in a meeting.
List everything downstream of the model, with the dbt script or dbt ls.
Add readers from the warehouse history that are not in the project.
Note the tier and owner of each downstream table and destination.
Tell the owners of anything Tier 1 or Tier 2 before the change merges, with what will change and when.
After the change, check that the downstream tables still build and their tests pass.
Teams that use continuous integration can automate the first step, running the downstream script for every changed model and posting the list on the pull request.
How do you use lineage in an incident?
When a Tier 1 number is wrong, lineage answers two questions at once.
Where did it go wrong? Walk upstream from the wrong number. Check freshness, row counts and recent changes for each table on the path, starting nearest the destination. The first table that looks wrong usually sits just below the cause.
Who needs to know? Walk downstream from the table that is wrong. Every destination on the list may be showing the same error, and its owner should hear about it before they make a decision from it.
The downstream half is easy to skip under pressure, and it is the half that limits the damage. The cost of bad data covers why the time an error goes unnoticed drives most of its cost.
How do you keep lineage accurate?
Every lineage graph has gaps. Knowing where they usually are is most of the work of closing them.
Work outside the transformation project. Scheduled queries, Python scripts and notebooks write tables that dbt never sees. The warehouse history catches these, so compare the two and investigate tables that appear only in the history.
Separate queries chained together. A stored procedure that reads into a temporary table in one statement and writes from it in another can break the link in query-based lineage. Snowflake’s documentation lists this case as untracked.
Data that leaves and comes back. A table exported to a spreadsheet, edited and loaded back has no recorded link to its source. Record these by hand, and treat them as a risk.
Short history windows. Lineage from history only shows what ran in the window. A table built once a quarter may not appear in 30 days of history, so keep a longer record or rebuild the graph across a full cycle.
Destinations nobody declared. A dashboard that reads through a service account shared by many tools hides behind that account. One service account per tool fixes it.
Refresh the graph on a schedule, daily for most teams, and keep the result as a table so it can be queried and compared over time.
What about lineage tools and open standards?
OpenLineage is an open specification for collecting lineage events, hosted by the LF AI & Data Foundation, with integrations for tools including Airflow, Spark, Flink, dbt and Trino. Jobs that emit OpenLineage events can feed any backend that reads them, and Google’s managed lineage can import them. It is worth considering when pipelines run across several engines and no single warehouse sees everything.
Data catalogs and observability tools also build lineage, usually by combining the same three sources described above. When comparing them, ask how each one handles the gaps in the previous section, how far back its history goes, and whether it captures the destinations as well as the tables.
A worked example
Here is how a first lineage graph might come together. The details are invented to show the method.
A data team wants to rename the amount column in fct_orders to amount_usd. The dbt script lists the models downstream, and the team has declared two exposures, the revenue dashboard and the monthly invoice run. The Snowflake history query shows one more reader the project does not know about: a scheduled Python script that writes a table for a churn model.
The team checks the tiers. The invoice run is Tier 1 and the churn model is Tier 2. They tell the head of billing and the owner of the churn model about the rename a week ahead, update the Python script in the same release, and add the churn model as an exposure so it appears next time. After the change, every downstream model builds, the invoice run reconciles and the churn table updates on schedule.
What mistakes should you avoid?
Stopping at the last table. Lineage without destinations cannot say what a table is for. Declare the consumers that matter most first.
Trusting one source. Code-based lineage misses work outside the project, and history-based lineage misses anything that has not run recently. Combine them.
Starting with column-level lineage everywhere. It is harder to keep accurate. Get table-level lineage complete for Tier 1 first.
Building a picture nobody can query. A diagram is good for explaining. Impact checks and incident tracing need the graph as data.
Never checking the gaps. Compare the code graph with the history graph regularly. The differences point straight at the blind spots.
Questions people ask
What is data lineage in simple terms?
A map of where each dataset comes from and what uses it, so you can see what will be affected by a change or an error.
What is the difference between data lineage and a data catalog?
A catalog describes datasets, such as their columns, owners and definitions. Lineage describes how datasets connect. Many catalogs include lineage, and lineage is more useful when each node carries the catalog’s details.
Is table-level lineage enough?
For most questions, yes. It answers what breaks if a table changes and who needs to hear about an incident. Add column-level lineage for wide tables that change often, sensitive data and disputed metrics.
How far back should lineage go?
Far enough to cover every job’s full cycle, including monthly and quarterly runs. Built from code, lineage has no window. Built from history, it needs at least one full cycle of the slowest job.
Who should maintain lineage?
The data platform team, as part of the transformation project. Technical owners of each dataset keep its exposures and descriptions current. How to assign data ownership covers those roles.
Can lineage be built without dbt?
Yes. Warehouse history gives table-level lineage for any tool that runs queries, and the queries above work without dbt. Destinations still need to be declared somewhere, such as a table of tools and the service accounts they use.
How long does it take to build a first lineage graph?
The table-level links from dbt and the warehouse history come from a few queries and a script, so a first graph can exist within days. Declaring the destinations and closing the gaps takes longer, because it means talking to the people who own the dashboards and applications. Start with the Tier 1 destinations and widen from there.
Do you need a separate tool for data lineage?
You can start without one. dbt’s manifest, the warehouse history and a table of edges give a working graph with tools most teams already run. A dedicated tool becomes worth it when pipelines span several engines, when many people need to browse the graph visually, or when column-level lineage is needed across tools that the warehouse cannot see.
How does lineage help with costs?
It shows which tables feed nothing anyone reads. Those are candidates to retire, and How to reduce Snowflake costs and How to reduce BigQuery costs cover what that saves.
Where Dataring fits
We built Dataring to rank every dataset by how much the business depends on it, then act on that ranking. Lineage is how the ranking reaches every upstream table, so the data behind billing, finance and customer-facing products gets the attention it needs, and pipelines nobody depends on are retired within limits each company sets, under its supervision.
Book a free call to see it on your data estate. For the wider process this guide fits into, read How to audit your data estate in seven steps.



