🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10
Deep DiveData Engineering14 min read

End-to-End Data Lineage and Metadata Observability in Modern Lakehouses

C
ChatWhole AI Team|2026-09-23

End-to-End Data Lineage and Metadata Observability in Modern Lakehouses

This data lineage lakehouse guide shows how to trace every column from source to dashboard automatically while metadata observability tests catch freshness, volume, and schema drift before production. Inside: a SQL AST parsing pipeline that produces column-level graphs, a comparison of five open metadata platforms, and a CI checklist your team can run in an afternoon.

Advertisement

Automated Data Lineage Extraction from Lakehouse Query Execution Graphs

Modern engines already know the graph you need. Spark, Trino, BigQuery, Snowflake, and dbt each emit or can be instrumented to emit execution metadata: the statements they ran, the tables and columns they touched, and the job that produced each write. Automated lineage extraction is the practice of capturing that runtime evidence and storing edges of the form job-run, output column, input column, instead of asking analysts to maintain a wiki.

Why runtime evidence beats manual catalogs

  • Execution graphs reflect what actually ran, including late-night backfills and ad-hoc notebook edits that never hit a review.
  • Column-level edges derive from projection lists, join keys, filters, and window functions with no human labeling step.
  • Every edge carries a run id, so auditors can join lineage to an Iceberg snapshot or Delta version later.

Step-by-step SQL AST parsing for column-level tracing

  1. Parse each statement into an abstract syntax tree with a dialect-aware parser: sqlglot, Apache Calcite, and JSqlParser all qualify.
  2. Inline CTEs and subqueries into one scope so aliases resolve to physical tables.
  3. Walk the projection list: every aliased expression in SELECT becomes an output column node.
  4. Collect references: each column inside those expressions becomes an input edge pointing at that output.
  5. Resolve aliases against the catalog so an alias like o maps to raw.orders.
  6. Propagate filters and joins: predicate and join columns are marked as consumed, which privacy scans depend on.
  7. Emit an OpenLineage event per run so Marquez, DataHub, or OpenMetadata can ingest the graph.
python
import sqlglot
from sqlglot import exp

sql = open("regional_revenue.sql").read()
ast = sqlglot.parse_one(sql, dialect="snowflake")
catalog = {"o": "raw.orders", "c": "raw.customers"}

def resolve(ref):
    return f"{catalog.get(ref.table, ref.table)}.{ref.name}"

edges = []
for expr in ast.expressions:
    if isinstance(expr, exp.Alias):
        out_col, subtree = expr.alias, expr.this
    else:
        out_col, subtree = expr.name, expr
    for ref in subtree.find_all(exp.Column):
        edges.append((f"mart.regional_revenue.{out_col}", resolve(ref)))

for where in ast.find_all(exp.Where):
    for ref in where.find_all(exp.Column):
        edges.append(("[filter]", resolve(ref)))

for out_col, in_col in edges:
    print(f"{out_col} <- {in_col}")

Key Takeaways

💡

  • Column-level lineage comes from parsing SQL ASTs at run time: projections become output nodes and referenced columns become input edges, with no spreadsheet in the loop.
  • OpenLineage is the de facto event standard, Marquez is its reference UI, and DataHub or OpenMetadata ingest the same events alongside dbt and BI metadata.
  • Iceberg, Delta Lake, and Hudi all offer time travel, which turns lineage into auditable evidence for GDPR and SOX reviews.
  • Metadata observability should cover freshness, volume, schema, and null rates with numeric thresholds encoded in CI rather than tribal knowledge.
  • Certified marts should require 100 percent upstream lineage coverage before promotion, because an empty lineage graph is a failed gate, not a green build.

Column-Level Lineage Propagation: SQL In, Column Graph Out

Given this daily aggregation:

SELECT
  c.customer_region,
  SUM(o.order_total) AS regional_revenue
FROM raw.orders o
JOIN raw.customers c
  ON o.customer_id = c.customer_id
WHERE o.order_status = 'completed'
GROUP BY c.customer_region;

The AST walk produces the following column graph for mart.regional_revenue:

Output column or clauseExpression inputsUpstream source columns
regional_revenueo.order_totalraw.orders.order_total
customer_region (group key)c.customer_regionraw.customers.customer_region
WHERE filtero.order_statusraw.orders.order_status
JOIN keyo.customer_id, c.customer_idraw.orders.customer_id, raw.customers.customer_id

Four edges, two source tables, zero manual annotations. Run the same walk across every dbt model or every Spark job in your orchestrator and the graph compounds nightly, which is exactly when hand-maintained catalogs collapse.

Open Metadata Platforms: Apache Atlas, DataHub, OpenLineage, Marquez, OpenMetadata

PlatformLineage granularityLakehouse fitStrengths and limits
Apache AtlasTable and column via hooksStrongest with HudiDeep governance, heavier ops footprint
DataHubColumn via SQL parsers and ingestIceberg and Delta connectorsGraphQL API, active community
OpenLineageSpec with column facetsEngine-agnostic: Spark, dbt, FlinkStandard, but not a UI by itself
MarquezInherits OpenLineage facetsSame as OpenLineageReference UI and API, simple to run
OpenMetadataColumn via query parsers and dbtBroad connector catalogAll-in-one UI with data quality built in

A pragmatic architecture for most teams: emit OpenLineage events from Spark and dbt, store and visualize in Marquez or OpenMetadata, and federate BI plus pipeline metadata into DataHub when a single discovery surface matters. Apache Atlas still earns its place in Hudi shops that already run Atlas alongside Ranger.

Sponsored

Time-Travel Audit Trails in Iceberg, Delta Lake, and Hudi

Lineage tells you what moved; time travel tells you what the numbers were. All three table formats keep snapshot metadata, so an auditor can pin a report to an exact instant:

-- Iceberg: pin a regulated table to a snapshot
SELECT * FROM finance.gl_entries
FOR TIMESTAMP AS OF '2026-09-01 00:00:00'
WHERE account_code LIKE '4%';

-- Delta Lake: enumerate versions, then read one
DESCRIBE HISTORY finance.gl_entries;
SELECT * FROM finance.gl_entries VERSION AS OF 4821;

-- Hudi: read an instant timestamp
SELECT * FROM finance.gl_entries AS OF '20260901000000';

Retention policy decides how auditable you actually are. Keep snapshots for at least 90 days so quarterly SOX sampling has coverage, expire old snapshots with documented vacuum settings, and store the snapshot id beside each published metric so lineage edges can be replayed against the exact data an auditor requests.

Regulatory Compliance: GDPR and SOX Impact Analysis with Lineage

Two regulations exercise different halves of the graph.

  • GDPR asks where a data subject's fields flow. Starting from raw.customers.email, column-level lineage enumerates every downstream mart, reverse-ETL destination, and export: the blast radius you must cover for deletion or anonymization requests. In medium warehouses one email column typically reaches 30 to 80 downstream columns across marts and feature stores.
  • SOX asks who changed the number and whether the control held. Pair each financial metric's lineage with a git commit, the transformation SQL, and an Iceberg or Delta snapshot from the same run. That triple is the evidence package most auditors accept.

Codify both with your platform team alongside declarative data contracts so producers promise schemas and consumers get lineage-backed SLAs in the same review.

Column-Level Metadata Observability: Freshness, Volume, and Schema Tests

Lineage without tests is a diagram; observability turns it into an alarm system with five dimensions.

DimensionIllustrative thresholdFailure action
FreshnessNewest event timestamp within 2 hours of wall clock for hourly tablesPage on-call, block downstream publishes
VolumeRow count inside 3 standard deviations of a 14-day same-hour baseline, else outside a 20 percent bandWarn and quarantine the bad partition
SchemaNo dropped or renamed columns on certified tablesFail CI on the breaking change
Null rateCritical identifier columns under 1 percent nullFail the row-level check
Lineage coverage100 percent of certified marts have upstream edgesFail the promotion gate

Encode each assertion as SQL or YAML in your orchestrator, for example a freshness check that fails the run when the newest event timestamp falls more than two hours behind scheduling time. Streaming consumers raise the bar: wire the same checks into consumers modeled on streaming RAG pipelines so late data never masquerades as fresh.

CI Lineage Gates: Block Merges on Broken Graphs

  1. Parse every changed SQL model in the pull request.
  2. Diff lineage edges against the base branch, and fail when certified downstream tables lose edges.
  3. Require freshness, volume, schema, null, and coverage tests to pass in the same job.
  4. Publish the updated OpenLineage event from CI so the catalog never lags the repository.
  5. Allow suppressions only with a linked ticket and an expiry date, so the gate cannot rot into a rubber stamp.
# illustrative CI gate for a PR that modifies SQL models
sqlglot-parse changed/**/*.sql --dialect snowflake
lineage diff --base origin/main --fail-on removed-edge-certified
elementary test --select state:modified --fail-fast
openlineage emit --job ci/dbt --run ci-$GITHUB_RUN_ID
Sponsored

Implementation Checklist

  1. Inventory engines — Spark, dbt, Trino, and BI tools — and confirm each can emit query text or execution metadata.
  2. Stand up a parser service on sqlglot or Calcite, and normalize dialects before edge extraction.
  3. Adopt OpenLineage as the event contract, then deploy Marquez or OpenMetadata as the first UI.
  4. Connect Iceberg or Delta snapshot ids to every published metric run.
  5. Author freshness, volume, schema, null, and lineage-coverage tests with numeric thresholds.
  6. Wire lineage diff and test execution into pull-request checks that fail on removed certified edges.
  7. Run a GDPR deletion drill and a SOX evidence export once per quarter to prove the graph works under pressure.
  8. Link transformation repos to data contracts and fixture pipelines such as synthetic data generation so test data inherits lineage too.

Common Mistakes

Merging a lineage gate that passes when the parser extracts zero edges

Fix: Fail closed: certified models must gain at least one upstream edge per changed column, and an empty parse result should block the promotion, not greenlight it.

Setting freshness thresholds without a same-hour baseline

Fix: Compare the newest event timestamp against a 14-day same-hour window so weekend or nightly dips do not page on-call for normal behavior.

Storing snapshot ids in the dashboard but not beside the published metric

Fix: Write the Iceberg or Delta snapshot id into the metric metadata at publish time, so a SOX or GDPR replay can pin the exact rows without archaeology.

Frequently Asked Questions

What is data lineage in a lakehouse?

Data lineage in a lakehouse is an automated record of how columns flow from raw ingestion tables through Iceberg, Delta, or Hudi transformations into marts and dashboards, including which job run created each edge. It is captured from SQL AST parsing and query execution logs rather than maintained by hand.

How is column-level lineage extracted from SQL?

By parsing each statement into an abstract syntax tree, resolving CTEs and aliases against the catalog, and walking the projection list: every aliased expression becomes an output column and every referenced column inside it becomes an input edge. Filters and join keys are recorded too, because privacy scans need consumed-column evidence.

Which open metadata platform should we choose?

Emit OpenLineage events first, because the spec is engine-agnostic and keeps you portable, then visualize with Marquez or OpenMetadata, and add DataHub when you need a single discovery surface across BI and pipelines. Choose Apache Atlas primarily if you already run Hudi with Ranger governance.

How does time travel support regulatory audits?

Iceberg, Delta Lake, and Hudi keep snapshot or version history, so auditors can re-read the exact rows a report saw on a past date and pin lineage edges to that snapshot id. Retaining snapshots for at least 90 days covers quarterly SOX sampling and most GDPR dispute windows.

What should a CI lineage gate block?

A CI lineage gate should block merges that remove lineage edges feeding certified tables, break schemas, or fail freshness, volume, and null-rate tests. Allow suppressions only with a linked ticket and an expiry date so the gate stays trustworthy over time.


Last updated: September 23, 2026

Explore More Articles

Search across 3100+ tutorials and news articles.