Mental model
When an executive dashboard number suddenly diverges or a GDPR deletion request requires finding every downstream AI feature table storing customer PII, manually reading 200 Spark scripts, dbt models, and Airflow DAGs fails immediately. OpenLineage establishes a vendor-neutral open standard (aligned conceptually with W3C PROV provenance graphs) where data engines themselves—Spark, Airflow, dbt, Flink, Trino—emit real-time runtime RunEvent telemetry during execution (START -> RUNNING -> COMPLETE/FAIL). Instead of brittle static SQL scraping alone, OpenLineage records immutable Job, Run, and Dataset entities enriched with typed JSON Facets covering table schemas, column-level provenance, row counts, data quality assertions, and Git code versions inside lineage catalogs such as Marquez, DataHub, or OpenMetadata.
Theory
OpenLineage cleanly solves the fragmented metadata puzzle through an extensible 3-entity core model paired with composable Facets:
| Core Entity / Concept | Identity Granularity | Standard OpenLineage Facets Attached | Practical Engineering Value |
|---|---|---|---|
Job (namespace + name) | Logical transformation definition (e.g. dbt://analytics.daily_orders) | SqlJobFacet, SourceCodeLocationFacet (Git SHA + PR URL!) | Tracks exact SQL/Spark logic across deployments cleanly |
Run (runId UUID) | Specific execution instance of a Job (START, COMPLETE, FAIL) | NominalTimeRunFacet, ParentRunFacet (links Airflow task -> Spark job -> SQL child!) | Separates yesterday's corrupted run from today's fixed rerun |
Dataset (namespace + name) | Physical input/output table or topic (postgres://db/public.users, s3://lake/orders) | SchemaDatasetFacet, ColumnLineageDatasetFacet, DataQualityMetricsInputDatasetFacet, SymlinksDatasetFacet | Pinpoints exact upstream breaking column changes before dashboards crash! |
Runtime Lineage vs. Static SQL Scraping—And Column-Level Impact Analysis
Traditional metadata crawlers parse static Git SQL files overnight, missing runtime truth when dynamic Airflow Jinja parameters inject partition dates, views alias Iceberg snapshots, or external Spark jobs bypass SQL altogether (Symlinks mapping Hive Metastore names cleanly to physical S3 URIs!). Emitting live RunEvent hooks from execution listeners captures what actually ran (nominalTime), attaches parent-child correlation (ParentRunFacet stitching an Airflow DAG -> Spark Operator -> Trino table load into one unified graph), and propagates Column-Level Lineage Facets (IDENTITY, TRANSFORMATION, AGGREGATION) automatically across joins (orders.subtotal_cents -> rev_daily.gross_usd). When an engineering squad wants to rename or drop a column in a production PostgreSQL table ingested by Debezium into an AI RAG feature pipeline, querying downstream OpenLineage graphs highlights every impacted downstream dbt model, Feast feature view, and training dataset cleanly inside CI pull requests before breaking schemas merge!
pythonfrom datetime import UTC, datetimeimport uuidimport requestsdef emit_openlineage_complete_event(endpoint: str,run_id: str,job_name: str,input_namespace: str,input_name: str,output_name: str,) -> int:# W3C PROV / OpenLineage compliant RunEvent linking inputs, outputs, and column lineage facetsevent = {"eventType": "COMPLETE","eventTime": datetime.now(UTC).isoformat(),"run": {"runId": run_id,"facets": {"processing_engine": {"version": "3.5.0", "name": "spark"},},},"job": {"namespace": "prod-etl", "name": job_name},"inputs": [{"namespace": input_namespace, "name": input_name}],"outputs": [{"namespace": "lakehouse://warehouse","name": output_name,"facets": {"schema": {"_producer": "https://github.com/OpenLineage/OpenLineage","_schemaURL": "https://openlineage.io/spec/facets/1-0-0/SchemaDatasetFacet.json","fields": [{"name": "tenant_id", "type": "STRING"},{"name": "total_tokens", "type": "BIGINT"},],},"columnLineage": {"_producer": "https://github.com/OpenLineage/OpenLineage","_schemaURL": "https://openlineage.io/spec/facets/1-2-0/ColumnLineageDatasetFacet.json","fields": {"total_tokens": {"inputFields": [{"namespace": input_namespace, "name": input_name, "field": "token_count"}],"transformationType": "AGGREGATION","transformationDescription": "SUM(token_count)",}},},},}],"producer": "https://acme.internal/etl-runner/1.0","schemaURL": "https://openlineage.io/spec/2-0-2/OpenLineage.json",}resp = requests.post(f"{endpoint}/api/v1/lineage", json=event, timeout=5)return resp.status_code
Keep lineage transport non-blocking / asynchronous (HTTP batch or Kafka topic backed by retry buffers): failure of the metadata backend (Marquez/DataHub) must never abort critical revenue ETL jobs!
Alternatives and trade-offs
- Runtime OpenLineage Listeners (
Spark,Airflow,dbt,Flink) -> Catalog (Marquez/DataHub/OpenMetadata): Captures live dynamic runtime parameters, real failed vs succeeded run boundaries, data-quality test facets, and unified cross-engine dependency graphs cleanly; demands deploying listener plugins across engines and storing noisy high-frequency run history cleanly with retention compaction. - dbt Docs + Manifest Graph Only: Built-in, zero extra infrastructure if
100%of your transformations stay inside warehouse SQL via dbt—blind cleanly to upstream Debezium/Airflow ingestion, Python ML notebooks, Feast feature stores, and Spark pipelines feeding dbt! - Static AST SQL Parsing Crawlers (e.g., SQLGlot CI bots): Helpful for instant pre-merge CI impact warnings before code runs in production, best combined alongside live OpenLineage telemetry rather than replacing execution audit trails.
Failure modes and misconceptions
- Inconsistent Dataset Namespace/Name Canonicalization ("Phantom Duplicate Tables"): If Airflow records
postgres://db-prod:5432/analytics.orders, dbt emitspostgres://10.4.2.9/analytics.public.orders, and Spark emitss3a://lake/orders, catalog graphs fail to connect upstream producers to downstream consumers cleanly! StandardizeDatasetnaming conventions +SymlinksDatasetFacetstrictly across all integrations. - Synchronous Lineage Emission Crashing ETL Jobs When Metadata Store Restarts: Making critical Airflow DAGs call blocking HTTP lineage posts without timeouts or failure isolation turns a minor DataHub outage into production billing pipeline downtime. Emit OpenLineage events cleanly to Kafka or non-blocking async HTTP handlers with short timeouts and fail-open error logging.
- Collecting Infinite Per-Partition Run History Without Catalog Compaction / Retention: Micro-batch Spark jobs emitting
START/COMPLETEevents every 30 seconds generate millions of bloatedRunEventJSON rows per month unless catalogs compact historic run payloads and deduplicate static unchanged schema facets. - Treating Table-Level Lineage as Sufficient for Schema Changes & PII Governance: Knowing
table_A -> table_Bdoesn't reveal whether droppingtable_A.email_hashbreaks downstreamtable_Bwhentable_Bonly actually readstable_A.order_total! Enable column-level lineage facets (ColumnLineageDatasetFacet) and classification tags cleanly for accurate impact analysis.
Decision scenario
Your data platform ingests PostgreSQL tables via Debezium/Airflow into Spark Iceberg lakes, transforms analytical cubes with dbt, and feeds ML training tables—recently suffering two multi-hour outages after an upstream database engineer dropped an "unused" column still consumed three hops downstream. Instrument Airflow, Spark (openlineage-spark), Trino, and dbt-ol to emit OpenLineage RunEvents asynchronously over Kafka into a central metadata catalog (DataHub/OpenMetadata) enforcing strict canonical dataset naming (<scheme>://<cluster>/<db>.<schema>.<table>) + SymlinksDatasetFacet, enable ColumnLineageDatasetFacet alongside DataQualityAssertionsDatasetFacet on every run, link orchestrator-to-engine spans via ParentRunFacet, and add a CI schema-check bot querying downstream column dependencies before approving breaking DDL pull requests.
Learning outcomes
- Explain OpenLineage's three-entity provenance model (
Job,Run,Dataset) and composableFacetarchitecture aligned with W3C PROV. - Contrast runtime OpenLineage event emission against static SQL AST crawlers and connect orchestrators cleanly via
ParentRunFacet. - Eliminate broken lineage joins using canonical dataset URIs and
SymlinksDatasetFacetwhile preserving ETL uptime via non-blocking emission. - Leverage column-level lineage graphs and data-quality facets for automated breaking-change impact checks and GDPR PII audits.
Trade-offs
Adopting OpenLineage unifies fragmented cross-engine observability, root-cause tracing, and regulatory PII auditing onto one open standard, at the engineering cost of dataset-naming standardization across engines, metadata catalog operation, and async run-history compaction.