DataHub Prefect plugin — automatically capture flow lineage and run metadata from Prefect workflows into your DataHub catalog
Project description
DataHub Prefect Plugin
Automatic lineage and run metadata from Prefect into DataHub — captures flow structure, task inputs/outputs, and run history with minimal setup.
What you can do
- Emit flow and task metadata to DataHub as pipeline runs
- Capture dataset lineage — declare inputs and outputs per task and see them in DataHub
- Configure via Prefect blocks — store your DataHub connection settings as a reusable block
- Works with any DataHub deployment — self-hosted or DataHub Cloud
Installation
pip install prefect-datahub
Quickstart
1. Save your DataHub connection as a Prefect block
from prefect_datahub.datahub_emitter import DatahubEmitter
DatahubEmitter(
datahub_rest_url="http://localhost:8080",
env="PROD",
).save("my-datahub")
2. Use it in your flows
from prefect import flow, task
from prefect_datahub.datahub_emitter import DatahubEmitter
from prefect_datahub.entities import Dataset
emitter = DatahubEmitter.load("my-datahub")
@task
def transform(data, emitter):
emitter.add_task(
inputs=[Dataset("snowflake", "mydb.schema.source_table")],
outputs=[Dataset("snowflake", "mydb.schema.output_table")],
)
return data
@flow
def my_pipeline():
data = extract()
transform(data, emitter)
emitter.emit_flow() # required — emits all metadata at the end
Configuration options
| Option | Default | Description |
|---|---|---|
datahub_rest_url |
http://localhost:8080 |
DataHub GMS URL |
env |
PROD |
Environment tag for assets |
platform_instance |
None |
Platform instance for assets |
token |
None |
Auth token (if GMS auth is enabled) |
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prefect_datahub-1.6.0.15.tar.gz
(13.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefect_datahub-1.6.0.15.tar.gz.
File metadata
- Download URL: prefect_datahub-1.6.0.15.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a74301deeb9ecc907d378fab81bc5c8d02a44eb018bad8c5097d0417082abab
|
|
| MD5 |
9f5a77f131b5636d20907004ff9d5863
|
|
| BLAKE2b-256 |
ed5ecf48bd2830fb45c7dad3c558d07d1e477a218640174a82e61627157b1789
|
File details
Details for the file prefect_datahub-1.6.0.15-py3-none-any.whl.
File metadata
- Download URL: prefect_datahub-1.6.0.15-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
833e2c10dd8423fbba8a3f792e208c61c8bb4ae9bbee4a7e49e136735140a811
|
|
| MD5 |
1e96de052366f6da26355e2c803f72b8
|
|
| BLAKE2b-256 |
c64ec7e29e3244bf1c59d60d497e8be528b40984294b1f64db4b9f3c41d975c3
|