Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Openlineage Prefect

The openlineage-prefect integration collects and adapts Prefect flow and task metatdata to the OpenLineage specification for data lineage. All transport options offered by openlineage-python are available, including intelligent routing of emitted events to Datadog and GCP, async http, http, and composite.

Features

The integration converts Prefect's unique run objects to idempotent tasks and flows, enabling the analysis of both over time in OpenLineage-compatible consumers.

Support for OpenLineage Datasets enables the aggregation of a data source's producers and consumers across OpenLineage-compatible systems and platforms. This allows for the tracking of external upstream and downstream dependencies of Prefect data sources together with their producing and consuming tasks in Prefect flows.

Basic Configuration

At a minimum, define a namespace, Prefect API URL, and transport consisting of a type, URL, and endpoint. All three can be supplied using environment variables.

For example:

export OPENLINEAGE_NAMESPACE='prefect_test' &&
export OPENLINEAGE__TRANSPORT__TYPE='http' &&
export OPENLINEAGE__TRANSPORT__URL='http://lineageconsumer.com:5000' &&
export OPENLINEAGE__TRANSPORT__ENDPOINT='/api/v1/lineage' &&
export PREFECT_API_URL='http://prefecthost.com:4200/api'

For more details of OpenLineage transport options and how to configure them, consult the OpenLineage Python Client Documentation.

Datasets

The integration looks for OpenLineage Datasets in Prefect Artifacts. To attach an input or output Dataset to a job run, use create_table_artifact from the Prefect Artifact library to create an Artifact in a task definition context. Provide a namespace -- e.g., the dataset URI -- and name via an Artifact's table and description, respectively. Distinguish the type of Dataset by appending _output or _input to the description.

For example:

ol_table = [{"database_uri":"duckdb:///customers_db", "table":"customers"}]

create_table_artifact(
    key="upstream-insert",
    table=ol_table,
    description="ol-dataset_output"
)

Execution

Import the PrefectOpenLineageListener class and execute the collect_and_process_runs method asynchronously in its own process.

For example:

import asyncio
from openlineage_prefect.prefect_adapter.listener import PrefectOpenLineageListener

async def main():
    await PrefectOpenLineageListener().collect_and_process_runs()

if __name__ == "__main__":
    asyncio.run(main())

Metadata

Release files for openlineage-prefect 0.0.1b9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openlineage-prefect 0.0.1b9
File Size Uploaded
openlineage_prefect-0.0.1b9.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openlineage-prefect 0.0.1b9
File Interpreter ABI Platform
openlineage_prefect-0.0.1b9-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / openlineage_prefect-0.0.1b9.tar.gz

Download URL openlineage_prefect-0.0.1b9.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b2943c7aefdd8c9859ead220b5961784d66b098566924f48e8dd2966fa2fdc95
BLAKE2b-256 checksum
How to use checksums
f8102b7f67c960770f4778b7249d14abcbd1993563eee5e1f3aa6a6d02fbd71e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / openlineage_prefect-0.0.1b9-py3-none-any.whl

Download URL openlineage_prefect-0.0.1b9-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e38e30c8c6440c37554b55e00b7a4a6be5278481c726f8d8b7c640b1d07bf6c9
BLAKE2b-256 checksum
How to use checksums
64432e38dceb7a3e0434db9abca587ff974f4b12acfc0bec6d8c4798c69e5076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page