Sub topic 2
What lineage is and the questions it answers
This chapter assumes you can write basic SQL, work in a Databricks workspace, and read three-level names such as main.sales.orders. You should also know what GRANT SELECT does. Later chapters cover how Unity Catalog captures lineage, how to browse it, and how to query it. This chapter defines lineage and shows which questions it can answer.
What lineage is
Data lineage is a record of how data moves and changes. It links each data asset to the assets it was built from and the assets built from it. Take a table daily_revenue that is computed from clean_orders, which is computed from orders. Lineage stores those links. It lets you walk from any asset toward its origins or toward its consumers.
Two directions matter, and the terms are used throughout the tutorial:
- Upstream means toward the sources. The upstream assets of
daily_revenueare the tables and files that were read to produce it. - Downstream means toward the consumers. The downstream assets of
ordersare the tables, dashboards, and jobs that read it, directly or indirectly.
Lineage is a graph. Nodes are assets, and edges mean "this asset was read to produce that one." One table can have many upstream and many downstream neighbors, so the graph branches in both directions.
In this graph, orders and customers are upstream of daily_revenue. The dashboard is downstream of every table in the chain. A change to orders can reach the dashboard even though the dashboard never reads orders directly. Lineage makes that indirect path visible.
Granularity: tables, columns, and the code between them
Unity Catalog records lineage at more than one level of detail.
| Level | What it records | Typical question |
|---|---|---|
| Table | Which tables were read to write which tables | Which tables feed `daily_revenue`? |
| Column | Which source columns contributed to a target column | Where does `revenue` come from? |
| Entity | Which notebook, job, pipeline, query, or dashboard did the work or consumed the data | Which job writes this table? |
Table lineage gives the broad picture. Column lineage is more precise. If revenue is computed from orders.amount and orders.discount, column lineage lists those two columns and leaves out the rest of orders. Entity information tells you what code ran. This matters because a table is rarely written by magic. A specific notebook or job wrote it, and that is the thing you open when something looks wrong.
The details of how these records are produced are in the next chapter. For now, treat lineage as something the platform collects as queries run. You do not draw it by hand.
The questions lineage answers
Lineage is useful because it turns vague worries into concrete lookups. The questions fall into a few groups.
Where did this number come from?
An analyst sees an unexpected value on a dashboard. Upstream lineage shows the tables behind it. Column lineage narrows that to the columns. The analyst can then inspect the real source instead of guessing which table is involved. This is the most common use, often called root cause analysis.
What breaks if I change this?
An engineer wants to rename a column, change a data type, or drop a table. Downstream lineage lists the consumers: other tables, jobs, and dashboards. Contact their owners first, or update them in the same change. This is impact analysis. Chapter 13 combines lineage with audit data to do it systematically.
Is this table still used?
Storage and compute cost money, and old tables pile up. If a table has no downstream edges and nothing has read it for a long time, it is a candidate for retirement. Lineage gives evidence for that decision. It does not prove the table is unused, because of the limits described below.
Where does sensitive data flow?
Suppose main.hr.employees holds personal data. Downstream lineage shows every table that was derived from it. Those derived tables may carry the same sensitive columns and may need the same protection. Column lineage is especially useful here because it can show which derived columns came from a sensitive source column.
Can I trust this data?
Trust depends partly on provenance. If a table is built from well-maintained, reviewed sources, you can use it with more confidence than a table built from an unknown scratch copy. Lineage lets a consumer check the chain before relying on a result.
A first look at a lineage query
Lineage is exposed through system tables, which you can query with SQL. Chapter 6 covers the table in detail. Here is one query so the questions above are not abstract. It lists the downstream tables that read from main.sales.orders.
SELECT DISTINCT
target_table_full_name,
entity_type
FROM system.access.table_lineage
WHERE source_table_full_name = 'main.sales.orders'
AND target_table_full_name IS NOT NULL;The WHERE clause fixes the source and asks for targets. Reversing the filter, with the target fixed and the source returned, gives the upstream view. The IS NOT NULL check removes events where nothing was written, such as a plain read by a dashboard or a query. The entity_type column says what kind of entity did the work, for example a notebook or a job.
This query returns direct neighbors only. It does not return the whole downstream graph. To reach tables two or more steps away, you repeat the query with each result as the new source. Catalog Explorer, covered in chapter 4, draws the multi-step graph for you.
What lineage does not tell you
Lineage is a record of reads and writes, so it has blind spots. Chapter 9 covers the limits fully. These are the ones to keep in mind from the start:
- It shows that data moved, not why. An edge says table A was read to produce table B. It does not say whether the logic was correct.
- Direct neighbors only in the raw data. Each lineage row describes one hop. Multi-step paths come from chaining rows.
- It is not a complete inventory of consumers. Some access happens outside what Unity Catalog observes. A table that looks unused in lineage may still be read by something that was not captured.
- It is time-bounded. Lineage is kept for a limited period. An edge from long ago may no longer be there.
- It reflects access, so it also reflects permissions. You see lineage only for assets you are allowed to see. A graph that looks short to you may be longer for someone with broader access.
Because of these limits, treat lineage as strong evidence and not as proof. If lineage says a table has no consumers, confirm with the table owner before dropping it.
Lineage and audit logs together
This tutorial pairs lineage with audit logs because they answer different questions about the same assets.
| Row | Lineage | Audit log |
|---|---|---|
| Focus | How data flows between assets | Who did what, and when |
| Unit of record | A read-write relationship between assets | An event by a user or service |
| Typical question | What depends on this table? | Who queried this table last week? |
Lineage tells you which assets are connected. The audit log tells you which people and services acted on them. Impact analysis needs both. Lineage finds the downstream assets, and the audit log shows who uses them, so you know whom to warn. You will build that combination in chapter 13.
Summary
Lineage is a graph of how data flows between assets, queried upstream toward sources or downstream toward consumers. It exists at table, column, and entity level. It answers questions about origin, impact of change, unused assets, sensitive data flow, and trust. It records executed reads and writes, so it has limits you must account for.
Exercise
The table main.sales.orders feeds main.sales.cleanorders, which feeds main.sales.dailyrevenue, which feeds a dashboard. You plan to change the data type of a column in orders. Which direction of lineage do you follow to find what might break, and why might the dashboard be affected even though it never reads orders?
Show answer
Follow downstream lineage from orders. The dashboard reads dailyrevenue, which was built from cleanorders, which was built from orders. A change in orders can pass through those tables and reach the dashboard indirectly. Column lineage can narrow this further by showing whether the changed column actually contributes to the downstream columns the dashboard uses.
Exercise
A query on system.access.tablelineage shows no downstream tables for main.finance.legacyledger. Can you safely drop it? Give two reasons for caution.
Show answer
Not on that evidence alone. First, lineage covers only a limited retention period and only access that Unity Catalog observed, so a consumer outside what was captured, or one that runs rarely, may be missing. Second, you may lack permission to see all lineage, so the result may be incomplete for you. Confirm with the table owner, and check audit data for recent access, before dropping it.