Schedule icon
Webhook icon
Log icon
Queries icon
Commands icon
Request icon
If icon
SlackIncomingWebhook icon
Pause icon

Automated OpenLineage Metadata Extraction and Marquez Governance Pipeline

Autonomous data governance in Kestra with DuckDB, OpenLineage, and Marquez. Automate schema facet extraction, quality guardrails, and Slack alerts.

Categories
DataInfrastructure

Diagram unavailable

We could not build the topology for this blueprint. The flow itself is valid, use the YAML on the left to run it.

Automate end-to-end data lineage extraction during DuckDB analytical SQL transformations, formatting standard OpenLineage 1-0-0 run event payloads (schema, input/output datasets, parent job facets) and emitting them to a Marquez metadata backend with automated quality gating and Slack alerting.

In enterprise data platforms, maintaining verifiable, end-to-end data lineage is mandatory for regulatory compliance (e.g., BCBS 239, GDPR, HIPAA), root-cause debugging, and data catalog synchronization. When data transformations run across distributed pipelines, metadata often becomes fragmented, resulting in silent data drift and broken downstream dependencies.

How it works

  1. setup_governance_context (io.kestra.plugin.core.log.Log) logs the pipeline execution ID, target database, and Marquez metadata endpoint.
  2. run_duckdb_transformation (io.kestra.plugin.jdbc.duckdb.Queries) executes in-process SQL analytical aggregation on DuckDB tables, aggregating raw transactions into a curated customer revenue mart.
  3. extract_openlineage_facets (io.kestra.plugin.scripts.python.Commands) executes containerized Python in python:3.11-slim, constructing compliant OpenLineage 1-0-0 run events with NominalTimeRunFacet, SchemaDatasetFacet, input/output dataset namespaces, and outputs runtime variables via Kestra ion format.
  4. emit_openlineage_to_marquez (io.kestra.plugin.core.http.Request) transmits the OpenLineage JSON payload directly to the Marquez REST API (POST /api/v1/lineage).
  5. verify_marquez_ingestion (io.kestra.plugin.core.log.Log) logs the ingestion response status.
  6. check_governance_guardrail (io.kestra.plugin.core.flow.If) evaluates validation results. On success, it triggers notify_slack_success. On failure or schema drift, it alerts DataOps via notify_slack_alert and halts execution using require_compliance_officer_approval (io.kestra.plugin.core.flow.Pause) until compliance officers sign off.

Who it's for

  • Data Engineers and DataOps leads managing analytical data marts and lakehouses.
  • Governance, Risk, and Compliance (GRC) teams requiring auditable data lineage.
  • Platform architects centralizing OpenLineage metadata across distributed pipelines.

Why orchestrate this with Kestra

Extracting data lineage alongside SQL transformations traditionally requires bulky external agents or manual catalog updates. Kestra combines the compute execution layer (DuckDB), containerized metadata extraction (Python), network dispatch (HTTP Request), conditional routing (If), and human-in-the-loop governance (Pause) into a single, declarative workflow.

Prerequisites

  • A running Marquez or OpenLineage-compatible server (e.g., Marquez on Docker or Cloud).
  • An active Slack Incoming Webhook URL for alerting.

Secrets

  • LINEAGE_WEBHOOK_KEY: Secret authentication key for the inbound webhook trigger.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for governance notifications.
  • MARQUEZ_API_KEY: (Optional) Bearer token for protected Marquez or OpenLineage API endpoints.

Inputs

Name Type Default Description
pipeline_id STRING customer-revenue-mart-v1 Unique identifier of the analytical data pipeline.
marquez_endpoint STRING http://marquez:5000/api/v1/lineage HTTP URL of the Marquez or OpenLineage ingestion API.
duckdb_database_path STRING /tmp/kestra_analytics.duckdb Filesystem path for local DuckDB storage.
alert_on_schema_drift BOOLEAN true Whether to pause the flow and trigger Slack alerts if schema drift is detected.

Quick start runbook

  1. Configure secrets LINEAGE_WEBHOOK_KEY, SLACK_WEBHOOK_URL, and optionally MARQUEZ_API_KEY in your Kestra namespace.
  2. Import the blueprint flow into your Kestra instance.
  3. Run the flow manually to execute the DuckDB transformation and emit OpenLineage metadata to Marquez.
  4. Verify the registered job, inputs, outputs, and schema facets in the Marquez Web UI.

How to extend

  • Connect Kestra to Apache Atlas, Collibra, or DataHub by updating the lineage HTTP endpoint.
  • Add dbt-core transformations upstream to automatically propagate dbt manifest lineage facets.
  • Implement automated schema drift rollback using GitOps webhooks.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.