Sub topic 9
What lineage does not capture, and how long it is kept
This chapter covers the limits of Unity Catalog lineage. It assumes you can query system tables, you know how lineage is captured at runtime, and you have read system.access.table_lineage and system.access.column_lineage in earlier chapters. You also need SELECT on those tables, as granted in the permissions chapter.
Lineage is a record of what the engine observed. If the engine did not observe a read or write, or if the record has aged out, the graph has a gap. A missing edge does not prove a dependency does not exist. This matters most when you use lineage for impact analysis or audits.
Why gaps matter
An impact analysis says "nothing downstream reads this table, so we can drop it". That is only as reliable as the lineage behind it. A job that reads the table by file path, or one that last ran 14 months ago, would not appear in the graph. Treat lineage as strong positive evidence ("this edge exists") and weak negative evidence ("no edge was seen").
What lineage does not capture
The exact list changes between releases, so check the current Databricks documentation before relying on any one case. These categories are stable enough to plan around.
Access that bypasses table names
Lineage is captured when a query goes through Unity Catalog and references securables by name. Access by path is different. Examples include spark.read.load("s3://bucket/path") and reading raw files with a library such as pandas or boto3. These reads either appear as a path-type source with no table identity, or do not appear at all. Column lineage generally needs table references, so path-based access gives you at best a coarse edge.
Compute and API paths that do not report lineage
Lineage depends on the compute and the API used:
- Compute must be Unity Catalog enabled, with a supported access mode and runtime version.
- Spark SQL and the DataFrame API report lineage. Low-level APIs such as RDD operations, or data pulled out to local Python and written back, break the chain between input and output.
- Code that reads a table into pandas, transforms it, and writes it to another table can record a read and a write without linking them to each other.
- Systems outside Databricks that read data through JDBC, external engines, or file access are not tracked as lineage entities.
Events before capture began
Lineage is not backfilled. A table that existed before it was registered in Unity Catalog has no lineage for earlier runs. A job that has not run since lineage capture was enabled has no edges. A pipeline that runs quarterly shows up only after its next run.
Changes in names and structure
Renaming a table or view can break the link to its history, because edges are recorded against the full name at the time of the event. Dropping and recreating a table, or moving it between schemas, produces a new identity. Plan to query both old and new names when tracing across a rename.
Meaning, not just mechanics
Lineage records that column A was used to produce column B. It does not record the transformation logic, whether the value was filtered, or whether the data was actually sensitive. It also does not tell you whether a downstream consumer is still in use, only that it read the data at some time within the retention window.
Visual summary
The diagram shows where an edge appears and where it is lost.
Retention
Lineage in the system tables is kept on a rolling window. At the time of writing, Databricks documents 365 days for the access schema tables, including table_lineage, column_lineage, and audit. Older events are removed and cannot be recovered. The lineage graph in Catalog Explorer draws from the same retention window.
Retention has three practical consequences:
- A pipeline that has not run for over a year drops out of lineage, even though it may still be deployed.
- Audits that look back further than a year cannot be answered from system tables alone.
- Lineage freshness is not instant. Events appear after a delay, so a job that just finished may not be visible yet.
The retention and latency figures are platform behavior, not settings you control. Confirm the current numbers in the documentation for your cloud before you commit to a compliance promise.
Checking what you actually have
Do not assume the window. Measure it for your metastore:
SELECT
min(event_date) AS earliest_event,
max(event_time) AS latest_event,
datediff(max(event_date), min(event_date)) AS days_covered,
count(*) AS row_count
FROM system.access.table_lineage;If days_covered is much smaller than 365, lineage capture started recently in your account. Any conclusion from the graph is limited to that period.
Finding path-based and unlinked activity
This query shows how much of the recorded activity touches paths rather than named tables for one target table. A high count tells you the graph for that table is incomplete.
SELECT
source_type,
target_type,
entity_type,
count(*) AS event_count
FROM system.access.table_lineage
WHERE event_date >= current_date() - INTERVAL 30 DAYS
AND (source_path IS NOT NULL OR target_path IS NOT NULL)
GROUP BY source_type, target_type, entity_type
ORDER BY event_count DESC;Rows with a source_path or target_path are the places where table identity was lost. These are the first jobs to review before you trust a "no downstream dependents" result.
Archiving lineage for longer history
If you need more than the retention window, copy the data into a table you own on a schedule. This example assumes the catalog main and schema governance already exist and that you can create tables in them.
CREATE TABLE IF NOT EXISTS main.governance.table_lineage_archive
AS SELECT * FROM system.access.table_lineage WHERE 1 = 0;
INSERT INTO main.governance.table_lineage_archive
SELECT *
FROM system.access.table_lineage
WHERE event_time > (
SELECT coalesce(max(event_time), TIMESTAMP '1970-01-01')
FROM main.governance.table_lineage_archive
);Run the INSERT as a scheduled job, at least daily. Because events can arrive late, an event with a timestamp earlier than the current maximum can be skipped. To avoid that, re-read a small overlap, such as the last two days, and remove duplicates with a MERGE on the columns that identify an event. Restrict access to the archive. It contains the same sensitive metadata as the source tables, and your own table is no longer protected by the system catalog's default restrictions.
Handling the gaps in practice
Use this checklist whenever a lineage result drives a decision:
- Confirm the window with the coverage query above.
- Check for path-based activity on the target table.
- Ask the owners of non-Databricks consumers (BI tools, external jobs, exports) whether they read the data directly.
- Cross-check with the audit log. Audit events record who requested table metadata and when, which can reveal readers that lineage missed.
- Record in your change ticket which of these checks you ran.
Common mistakes
| Mistake | Why it fails | Better approach |
|---|---|---|
| Treating "no rows" as "no dependents" | Path access, old runs, and unsupported compute leave no edge | Check coverage, path activity, and audit events |
| Assuming lineage exists before capture started | Lineage is not backfilled | Measure the earliest event date |
| Tracing across a rename with one name | Edges are keyed on the name at event time | Query old and new names |
| Promising multi-year history from system tables | Rolling retention removes old events | Archive to your own table |
| Granting broad access to an archive | Metadata can reveal sensitive pipelines | Match the grants on the system tables |
Exercise
A teammate wants to drop main.sales.orders_legacy. Your downstream query on system.access.table_lineage returns no rows, and the earliest lineage event in your metastore is 40 days old. What should you tell them, and which two checks would you run next?
Show answer
A result of no rows does not show the table is unused. Lineage covers only 40 days here, so quarterly or annual jobs may not have run since capture began. Also, readers using file paths, RDD or pandas steps, or external engines may leave no edge. First, run the coverage query and the path-based activity query to see how complete the graph is for this table. Second, query system.access.audit for recent events on main.sales.orders_legacy, such as getTable, to find users or tools that still access it. Only drop the table after both checks, plus confirmation from owners of non-Databricks consumers, show no use.