Sub topic 2
System Tables: Where Governance Data Is Exposed
Assume you know basic SQL, Databricks workspaces, and the Unity Catalog namespace catalog.schema.table. System tables expose governance events as queryable rows instead of requiring manual inspection.
Lineage and Audit System Tables
Unity Catalog stores governance data in the system catalog. The system.access schema contains tables such as:
table_lineage: relationships between source and target tables.column_lineage: relationships between source and target columns.audit: actions performed against Databricks and Unity Catalog resources.
flowchart TD
A[Databricks job or notebook] --> B[Unity Catalog captures event]
B --> C[system.access.table_lineage]
B --> D[system.access.column_lineage]
B --> E[system.access.audit]
C --> F[Impact analysis]
D --> F
E --> G[Access review]Querying Table Lineage
Table lineage records which tables contributed to a target table. It can also identify the job, notebook, or other entity involved.
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;To assess the effect of changing main.sales.orders, reverse the question and find its downstream targets:
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;Column-Level Lineage
Column lineage narrows the relationship to individual fields. This helps when a change affects one column rather than an entire table.
SELECT DISTINCT
source_table_full_name,
source_column_name,
target_column_name
FROM system.access.column_lineage
WHERE target_table_full_name = 'main.sales.daily_revenue'
AND target_column_name = 'revenue';Visibility and Limits
Lineage visibility follows Unity Catalog permissions. A governance group needs access to the system catalog, the system.access schema, and the specific tables. Grant only the read access required for the group's work.
GRANT USE CATALOG ON CATALOG system TO `data-governance`;
GRANT USE SCHEMA ON SCHEMA system.access TO `data-governance`;
GRANT SELECT ON TABLE system.access.table_lineage TO `data-governance`;
GRANT SELECT ON TABLE system.access.column_lineage TO `data-governance`;
GRANT SELECT ON TABLE system.access.audit TO `data-governance`;Audit Logs
The audit table records actions, identities, timestamps, request parameters, and response status. Filter service_name, action_name, and object fields to avoid scanning unrelated events.
SELECT
event_time,
user_identity.email AS user_email,
action_name,
request_params.full_name_arg AS table_name,
response.status_code
FROM system.access.audit
WHERE service_name = 'unityCatalog'
AND action_name = 'getTable'
AND request_params.full_name_arg = 'main.sales.daily_revenue'
ORDER BY event_time DESC;Exercise
Which table should you query to find the source column for a target column?
Show answer
Query system.access.column_lineage.