EX-11: Harvesting AST Column Lineage in Databricks
Track: Lineage & BCBS 239 • Difficulty: Intermediate • Mastery Points: 150 PTS
Business Problem Scenario
Regulators and external statutory auditors demand end-to-end mathematical traceability from executive board pack metrics back to the raw transactional ledger. In Databricks Unity Catalog, runtime query plans are automatically parsed into Abstract Syntax Trees (AST) to populate system.access.column_lineage. You must write a lineage extraction query that discovers all direct upstream source tables and columns contributing to the regulatory return metric gold.deposits_return.reported_gbp.
Engineering Objective
Write a column lineage query against system.access.column_lineage. • Expected Columns: source_table_full_name, source_column_name, target_table_full_name, target_column_name • Acceptance Criteria: Filter where target_table_full_name = 'gold.deposits_return' AND target_column_name = 'reported_gbp'. • Directional Lineage Note: Upstream queries trace from a target backward to its feeder sources; downstream queries trace forward from a source to its dependent consumers. Key Concepts: - AST Lineage: Programmatic lineage harvested by the SQL compiler analyzing the logical query plan at execution time. - End-to-End Traceability: Proof of provenance connecting board-level regulatory disclosures to underlying ledger entries.
Target Table: system.access.column_lineage (source_table_full_name STRING, source_column_name STRING, target_table_full_name STRING, target_column_name STRING)
Verification & Architecture Insights
Automated AST column lineage proves to regulators that reported_gbp was computed from authoritative core_balances and fx_rates without unrecorded manual query overrides.