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
Metadata
Release files for prefect-datahub 1.7.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prefect_datahub-1.7.0.12.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prefect_datahub-1.7.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / prefect_datahub-1.7.0.12.tar.gz
| Download URL | prefect_datahub-1.7.0.12.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5ad749dc589a3a8ec0f2af5d5155bf8756ed1241273e36092cfafd9989694c6
|
|
BLAKE2b-256 checksum How to use checksums |
a7fce4088d37ecd443d9ef6b4e34750d2dca6fb290630d13af971f4b5e83f08e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.21
|
Release files / prefect_datahub-1.7.0.12-py3-none-any.whl
| Download URL | prefect_datahub-1.7.0.12-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2718b03c1f6780509e93d264cfa8bd47ba774fd605ee0b2d920588b6ce088ef
|
|
BLAKE2b-256 checksum How to use checksums |
ddd14a7d3b4e9e2d9ec35e1bdcb9ff23cf57770e7ff536a9d82a891d63b80254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.21
|