Sub topic 2
What lineage is and the questions it answers
This chapter assumes you know basic SQL, can work in a Databricks notebook or SQL warehouse, and understand the Unity Catalog three-level namespace (catalog.schema.table). It defines lineage and shows the questions it answers. Later chapters cover how it is captured and how to query it.
What lineage records
Data lineage is a record of how data moves from its sources to the tables and columns that depend on it. Unity Catalog records lineage at two levels:
- Table-level lineage records that table B was written by reading table A.
- Column-level lineage records that column
revenuein table B was computed from specific columns in the source tables.
Lineage also records the entity that did the work, such as a notebook, a job, a query, or a pipeline. This lets you see what produced a table, not only what it was built from.
Two directions matter:
- Upstream means the sources that feed an object.
- Downstream means the objects that read from it.
In this graph, orders and customers are upstream of daily_revenue. The dashboard and forecast are downstream of it.
Questions lineage answers
Lineage turns vague worries into specific lookups. The common questions fall into a few groups.
| Question | Direction | Typical use |
|---|---|---|
| Where did this number come from? | Upstream | Debugging a wrong report |
| What will break if I change this column? | Downstream | Planning a schema change |
| Which jobs write this table? | Upstream, with entities | Finding the owner of a pipeline |
| Does personal data reach this table? | Upstream, column level | Privacy and compliance reviews |
| Is anything still using this table? | Downstream | Safe deprecation |
A worked example
Suppose a finance analyst reports that main.sales.daily_revenue dropped sharply on Tuesday. You have no idea why. Lineage gives you a path to follow:
- Look upstream of
daily_revenue. You find it readsmain.sales.ordersandmain.sales.customers. - Check the column-level lineage for
revenue. It comes fromorders.amount. - Look at which entity wrote
orders. A job namedingest_ordersdid, and it is the first place to check for a failed run.
Now suppose the data engineering team wants to rename orders.amount. You reverse the question and look downstream. The lineage shows daily_revenue, and through it forecast and a dashboard. You know whom to notify before making the change.
The same graph can be read with SQL. The query below lists the tables that were read to produce a target table. Later chapters explain the system tables and permissions it needs.
SELECT DISTINCT
source_table_full_name,
source_type,
entity_type,
event_time
FROM system.access.table_lineage
WHERE target_table_full_name = 'main.sales.daily_revenue'
AND source_table_full_name IS NOT NULL
ORDER BY event_time DESC
LIMIT 100;What lineage is not
Lineage describes data flow. It does not tell you who accessed a table or when. That is the job of audit logs, which come later in this tutorial. The two complement each other. Lineage answers "what depends on what", and audit answers "who did what".
Lineage is also a record of observed activity. It reflects work that has run, so a pipeline that has never executed will not appear in the graph. Chapter on limitations covers this in detail.
Exercise
A team wants to drop the column main.sales.orders.discount_code. Which direction of lineage should they check first, and what are they looking for?
Show answer
They should check downstream lineage, preferably at column level. They are looking for tables, jobs, dashboards, or other consumers that read discount_code, so those owners can be notified or updated before the column is dropped.
Exercise
An executive questions a figure in main.finance.forecast. Which direction do you trace, and what two things can you learn from the entities in the lineage?
Show answer
Trace upstream. You can learn which source tables feed the forecast and which notebooks, jobs, or pipelines wrote to it, so you can check those for failures or logic changes.