DataHub Data Catalog
When to Use
Activate this skill when the task involves:
- Setting up or configuring DataHub (Docker Compose quickstart or Kubernetes Helm deployment)
- Writing ingestion recipes in YAML for PostgreSQL, Hive, Spark, dbt, Airflow, Kafka, or S3
- Using the DataHub Python SDK to emit metadata, lineage, or schema programmatically
- Implementing table-level or column-level lineage via
DatahubRestEmitter and FineGrainedLineage - Managing metadata entities — Dataset, DataFlow, DataJob, Dashboard, Chart — with ownership, tags, and glossary terms
- Searching and discovering assets via the UI, REST API, or GraphQL lineage traversal
- Integrating dbt artifact ingestion or the
datahub-airflow-plugin for pipeline lineage - Running CLI operations:
datahub ingest, datahub check, datahub delete, datahub timeline
Architecture Overview
┌──────────────────────────────────────────────────────────────────────────────┐
│ DataHub Architecture │
│ │
│ Producers Ingestion Layer Storage & Serving │
│ ┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐ │
│ │ Ingestion │──MCP/MCE─▶│ GMS │─────▶│ MySQL / Postgres │ │
│ │ Framework │ │ (Metadata Store)│ │ (aspects store) │ │
│ └──────────────┘ └────────┬────────┘ └──────────────────┘ │
│ ┌──────────────┐ │ MCL │
│ │ REST Emitter │──MCP REST─▶ │ (via Kafka CDC) │
│ └──────────────┘ ┌────────▼────────┐ ┌──────────────────┐ │
│ ┌──────────────┐ │ MAE Consumer │─────▶│ Elasticsearch │ │
│ │ Kafka topic │──MCP──────│ MCE Consumer │ │ (search index) │ │
│ │ (async) │ └─────────────────┘ └──────────────────┘ │
│ └──────────────┘ ┌──────────────────┐ │
│ │ Neo4j (optional) │ │
│ DataHub Frontend ◀───────│ (graph store) │ │
│ :9002 └──────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────┘
Core Services
| Component | Role | Default Port | |
|---|
| GMS (Generalized Metadata Service) | Central metadata store; accepts MCPs via REST or Kafka | 8080 | |
| MCE Consumer | Async Kafka consumer for MetadataChangeEvent_v4 topic | — | |
| MAE Consumer | Processes MetadataAuditEvent_v4; updates Elasticsearch + graph | — | |
| Frontend | React SPA serving search, lineage graph, and entity pages | 9002 | |
| Elasticsearch | Full-text search index; updated asynchronously from GMS | 9200 | |
| Kafka | Message bus for MCP/MCL event streams | 9092 | |
| MySQL / PostgreSQL | Persistent aspect store | 3306 / 5432 | |
Event Types
| Event | Direction | Description | |
|---|
| MCP (MetadataChangeProposal) | Producer → GMS | Proposes a change to a single aspect of one entity | |
| MCE (MetadataChangeEvent) | Producer → Kafka topic | Older batched event; prefer MCP for new integrations | |
| MCL (MetadataChangeLog) | GMS → downstream consumers | Confirmed change log after GMS writes the aspect | |
| MAE (MetadataAuditEvent) | GMS → Kafka | Legacy audit event; replaced by MCL in v0.9+ | |
Deployment
Docker Compose Quickstart
bash
pip install acryl-datahub
datahub docker quickstart # pulls docker-compose and starts all services
# Access UI at http://localhost:9002 (default: datahub / datahub)
# GMS REST at http://localhost:8080
Full compose override for resource-constrained environments:
yaml
# docker-compose.override.yml
version: "3.8"
services:
datahub-gms:
environment:
DATAHUB_SERVER_TYPE: quickstart
ELASTICSEARCH_USE_SSL: "false"
deploy:
resources:
limits:
memory: 2g
elasticsearch:
deploy:
resources:
limits:
memory: 1g
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
Kubernetes Helm Deployment
bash
helm repo add datahub https://helm.datahubproject.io/
helm repo update
# Install prerequisites (Kafka, Elasticsearch, MySQL)
helm install prerequisites datahub/datahub-prerequisites \
--namespace datahub --create-namespace \
-f prerequisites-values.yaml
# Install DataHub
helm install datahub datahub/datahub \
--namespace datahub \
-f datahub-values.yaml \
--version 0.4.0
Minimal datahub-values.yaml for production:
yaml
global:
graph_service_impl: elasticsearch # use neo4j for advanced graph queries
datahub_analytics_enabled: true
datahub-gms:
replicaCount: 2
resources:
requests:
cpu: "1"
memory: 2Gi
limits:
cpu: "2"
memory: 4Gi
env:
DATAHUB_SERVER_TYPE: prod
KAFKA_BOOTSTRAP_SERVER: "kafka-headless:9092"
EBEAN_DATASOURCE_HOST: "mysql:3306"
EBEAN_DATASOURCE_USERNAME: datahub
EBEAN_DATASOURCE_PASSWORD: "${MYSQL_PASSWORD}"
ELASTICSEARCH_HOST: "elasticsearch-master"
ELASTICSEARCH_PORT: "9200"
datahub-frontend:
replicaCount: 2
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: "1"
memory: 2Gi
datahub-mae-consumer:
replicaCount: 1
resources:
requests:
memory: 512Mi
limits:
memory: 1Gi
datahub-mce-consumer:
replicaCount: 1
Minimum cluster requirements: 3 nodes, 7 GB RAM total; 16 GB RAM recommended for production.
Ingestion Framework
Installation
bash
# Base CLI
pip install 'acryl-datahub[datahub-rest]'
# Source-specific extras
pip install 'acryl-datahub[postgres]'
pip install 'acryl-datahub[hive]'
pip install 'acryl-datahub[spark]'
pip install 'acryl-datahub[dbt]'
pip install 'acryl-datahub[airflow]'
pip install 'acryl-datahub[kafka]'
pip install 'acryl-datahub[s3]'
Recipe YAML Format
Every ingestion job is a recipe file:
yaml
# recipe.yaml — top-level keys: source, sink, transformers, schedule
source:
type: <source-type> # e.g. postgres, hive, dbt, kafka, s3
config:
<source-specific-config>
transformers: # optional, applied in order
- type: simple_add_dataset_tags
config:
tag_urns:
- "urn:li:tag:pii"
sink:
type: datahub-rest # or datahub-kafka for async
config:
server: "http://datahub-gms:8080"
token: "${DATAHUB_TOKEN}" # personal access token
pipeline_name: my_ingestion_job # used for run tracking / rollback
# For scheduled runs via datahub-airflow-plugin (cron expression):
# schedule:
# interval: "0 6 * * *"
# timezone: "UTC"
Ingestion Recipes by Source
PostgreSQL
yaml
source:
type: postgres
config:
host_port: "prod-postgres:5432"
database: analytics
username: datahub_reader
password: "${POSTGRES_PASSWORD}"
include_tables: true
include_views: true
profiling:
enabled: true
profile_table_level_only: false
stateful_ingestion:
enabled: true
remove_stale_metadata: true
sink:
type: datahub-rest
config:
server: "http://datahub-gms:8080"
Hive
yaml
source:
type: hive
config:
host_port: "hive-metastore:10000"
scheme: hive
username: hive
password: "${HIVE_PASSWORD}"
database: "prod_db" # omit to ingest all databases
include_column_lineage: true
stateful_ingestion:
enabled: true
sink:
type: datahub-rest
config:
server: "http://datahub-gms:8080"
Spark
yaml
# Spark lineage is typically captured at runtime via the Spark listener JAR,
# not a standalone recipe. For post-hoc Spark metadata ingestion:
source:
type: spark
config:
# Spark listener emits MCPs to DataHub during spark-submit
# Add to spark-submit:
# --packages io.acryl:acryl-spark-lineage:0.2.16
# --conf spark.extraListeners=datahub.spark.DatahubSparkListener
# --conf spark.datahub.rest.server=http://datahub-gms:8080
Runtime Spark configuration:
python
spark = SparkSession.builder \
.appName("etl_job") \
.config("spark.extraListeners", "datahub.spark.DatahubSparkListener") \
.config("spark.datahub.rest.server", "http://datahub-gms:8080") \
.config("spark.datahub.rest.token", os.environ["DATAHUB_TOKEN"]) \
.config("spark.datahub.env", "PROD") \
.config("spark.datahub.flow_name", "silver_etl_pipeline") \
.getOrCreate()
dbt
yaml
source:
type: dbt
config:
manifest_path: "s3://my-bucket/dbt-artifacts/manifest.json"
catalog_path: "s3://my-bucket/dbt-artifacts/catalog.json"
run_results_paths:
- "s3://my-bucket/dbt-artifacts/run_results.json"
target_platform: trino # underlying SQL platform
target_platform_instance: prod-trino
environment: PROD
include_column_lineage: true
meta_mapping:
owner:
match: ".*"
operation: "add_owner"
config:
owner_type: corpuser
tag_prefix: "dbt:" # tags prefixed with "dbt:" in DataHub
stateful_ingestion:
enabled: true
remove_stale_metadata: true
aws_connection:
aws_access_key_id: "${AWS_ACCESS_KEY_ID}"
aws_secret_access_key: "${AWS_SECRET_ACCESS_KEY}"
aws_region: "us-east-1"
sink:
type: datahub-rest
config:
server: "http://datahub-gms:8080"
Airflow
yaml
# Captures DAG/task metadata and lineage via the datahub-airflow-plugin.
# Install: pip install acryl-datahub[airflow]
# Add to airflow.cfg:
# [datahub]
# enabled = true
# conn_id = datahub_rest_default
# Airflow Connection (datahub_rest_default):
# conn_type: datahub_rest
# host: http://datahub-gms:8080
# extra: {"token": "<PAT>"}
# For recipe-based DAG metadata ingestion:
source:
type: airflow
config:
base_url: "http://airflow-webserver:8080"
airflow_connection_id: datahub_rest_default
# Captures: DAGs as DataFlows, Tasks as DataJobs
# with inlet/outlet annotations as dataset lineage
Annotate Airflow tasks for automatic dataset lineage:
python
from airflow.lineage.entities import Table
from datahub_airflow_plugin.entities import Dataset, Urn
with DAG("daily_etl", ...) as dag:
@task(
inlets=[Dataset("postgres", "public.orders")],
outlets=[Dataset("hive", "gold.daily_revenue")],
)
def transform_orders(**kwargs):
...
Kafka
yaml
source:
type: kafka
config:
connection:
bootstrap: "kafka-broker:9092"
schema_registry_url: "http://schema-registry:8081"
topic_patterns:
allow:
- "^prod\\..*"
deny:
- ".*\\.dlq$"
stateful_ingestion:
enabled: true
sink:
type: datahub-rest
config:
server: "http://datahub-gms:8080"
S3
yaml
source:
type: s3
config:
path_specs:
- include: "s3://data-lake/bronze/{table}/**/*.parquet"
table_name: "{table}"
aws_config:
aws_region: "us-east-1"
aws_access_key_id: "${AWS_ACCESS_KEY_ID}"
aws_secret_access_key: "${AWS_SECRET_ACCESS_KEY}"
profiling:
enabled: false # enable for row/column stats
max_rows: 100 # rows sampled for schema inference
sink:
type: datahub-rest
config:
server: "http://datahub-gms:8080"
Metadata Entities and URN Format
Entity Types