Production-ready Apache Airflow DAG templates for modern data pipelines.
Skip the boilerplate. Start with 14 battle-tested DAGs covering ETL, data quality, ML pipelines, warehouse loading, CDC streaming, database replication, SLA monitoring, dynamic task mapping, and more.
| Category | Count | Highlights |
|---|---|---|
| DAG templates | 14 | ETL, ML, CDC, dbt, warehouse, replication, SLA, cleanup |
| Custom operators | 4 | Spark submit, data quality, Databricks notebook, Delta sensor |
| Custom hooks | 2 | Slack webhook, Microsoft Teams webhook |
| Custom sensors | 1 | Extended S3 key sensor with size/age checks |
| Config files | 3 | Connections, variables, DAG factory config |
| Test suite | 1 | DAG integrity, plugin validation, config checks |
| Best practices guide | 1 | 450+ lines covering TaskFlow, dynamic mapping, SLAs |
Total: 29 files, 7,000+ lines of production-quality code and documentation.
airflow-dag-templates/
├── README.md # This file
├── manifest.json # Product manifest
├── LICENSE # MIT License
│
├── dags/ # 14 production DAG templates
│ ├── etl_pipeline_dag.py # Full ETL: extract → transform → quality → load
│ ├── data_quality_dag.py # Data quality checks with Slack alerts
│ ├── dbt_orchestration_dag.py # dbt run → test → docs generation
│ ├── api_ingestion_dag.py # REST API → S3 → Spark processing
│ ├── cdc_streaming_dag.py # Debezium → Kafka → Delta Lake CDC
│ ├── backfill_dag.py # Parameterized historical backfill
│ ├── file_sensor_dag.py # S3 file watching with format routing
│ ├── data_warehouse_load_dag.py # Multi-target warehouse loading (Snowflake/Redshift)
│ ├── ml_pipeline_dag.py # ML training with evaluation gates
│ ├── database_replication_dag.py # Full & incremental database replication
│ ├── sla_monitoring_dag.py # SLA checks with tiered alerting
│ ├── cleanup_dag.py # Table cleanup, temp files, retention policies
│ ├── cross_dag_dependency_dag.py # ExternalTaskSensor & TriggerDagRun patterns
│ └── dynamic_task_mapping_dag.py # Airflow 2.3+ dynamic task mapping
│
├── plugins/ # Custom Airflow plugins
│ ├── operators/
│ │ ├── spark_submit_operator.py # Databricks Spark job submission
│ │ ├── data_quality_operator.py # Configurable data quality checks
│ │ ├── databricks_notebook_operator.py # Databricks notebook execution
│ │ └── delta_table_sensor.py # Delta Lake table freshness sensor
│ ├── hooks/
│ │ ├── slack_webhook_hook.py # Slack webhook notifications
│ │ └── teams_webhook_hook.py # Microsoft Teams webhook notifications
│ └── sensors/
│ └── s3_key_sensor_extended.py # S3 sensor with size/age validation
│
├── configs/ # Configuration templates
│ ├── connections.yaml # Airflow connection definitions
│ ├── variables.yaml # Airflow variable definitions
│ └── dag_factory_config.yaml # Config-driven DAG generation
│
├── tests/ # Test suite
│ └── test_dags.py # DAG integrity & plugin tests
│
└── guides/ # Documentation
└── airflow-best-practices.md # Comprehensive best practices guide
| DAG | Schedule | Description |
|---|---|---|
etl_pipeline_dag | @daily | Full ETL pipeline with extract, transform, quality checks, and load stages. Configurable source/target tables with SLA monitoring. |
data_quality_dag | @daily | Runs freshness, null-rate, uniqueness, and row-count checks across configured tables. Sends Slack alerts on failure. |
dbt_orchestration_dag | @daily | Orchestrates dbt: seed → run → test → docs generate → deploy. Includes model selection and full refresh support. |
api_ingestion_dag | @hourly | Pulls data from REST APIs with pagination, rate limiting, and retry logic. Lands raw JSON in S3, then transforms via Spark. |
| DAG | Schedule | Description |
|---|---|---|
cdc_streaming_dag | @hourly | Manages Debezium CDC connectors: deploy → monitor → merge into Delta Lake tables. |
database_replication_dag | @daily | Full and incremental replication between source and target databases with validation. |
| DAG | Schedule | Description |
|---|---|---|
file_sensor_dag | @hourly | Watches S3 prefixes for new files, routes by format (CSV/JSON/Parquet), and processes with appropriate handlers. |
data_warehouse_load_dag | @daily | Multi-target warehouse loading supporting Snowflake and Redshift patterns: staging → dedup → merge → statistics. |
ml_pipeline_dag | @weekly | End-to-end ML pipeline: data prep → feature engineering → training → evaluation gate → conditional deployment. |
dynamic_task_mapping_dag | @daily | Demonstrates Airflow 2.3+ dynamic task mapping: expand(), partial(), expand_kwargs(), and map-reduce patterns. |
| DAG | Schedule | Description |
|---|---|---|
backfill_dag | Manual | Parameterized backfill DAG with date range chunking, parallelism control, and progress tracking. |
sla_monitoring_dag | */15 * * * * | Monitors DAG SLAs across the deployment. Tiered alerting: P1 (page), P2 (Slack), P3 (log). |
cleanup_dag | @daily | Cleans up temporary tables, stale files, old XCom entries, and enforces retention policies. |
cross_dag_dependency_dag | @daily | Reference implementation for ExternalTaskSensor and TriggerDagRunOperator patterns. |
Follow this guide to get airflow dag templates up and running in your environment.
# Copy DAGs
cp dags/*.py $AIRFLOW_HOME/dags/
# Copy plugins (preserves directory structure)
cp -r plugins/ $AIRFLOW_HOME/plugins/
# Copy configs (for reference / import)
cp -r configs/ $AIRFLOW_HOME/configs/Use the YAML templates in configs/ to set up connections:
# Import connections
airflow connections import configs/connections.yaml
# Import variables
airflow variables import configs/variables.yamlOr configure manually via the Airflow UI under Admin → Connections and Admin → Variables.
Each DAG has clearly marked # TODO: sections for project-specific customization:
# Example: customize the ETL DAG
DAG_CONFIG = {
"source_table": "raw.events", # TODO: your source table
"target_table": "analytics.events_clean", # TODO: your target table
"schedule": "@daily",
"owner": "data-team",
}You don't need all 14 DAGs. Pick the ones that match your use case:
etl_pipeline_dag + data_quality_dag + cleanup_dagdbt_orchestration_dagapi_ingestion_dag + file_sensor_dagml_pipeline_dagcdc_streaming_dag + database_replication_dagcross_dag_dependency_dag + sla_monitoring_dagdynamic_task_mapping_dag| Operator | Module | Description |
|---|---|---|
SparkSubmitOperator | plugins.operators.spark_submit_operator | Submits Spark jobs to Databricks clusters with configurable libraries and parameters. |
DataQualityOperator | plugins.operators.data_quality_operator | Runs configurable quality checks (nulls, row count, freshness, uniqueness) against any table. |
DatabricksNotebookOperator | plugins.operators.databricks_notebook_operator | Executes Databricks notebooks with parameter passing, cluster selection, and output capture. |
DeltaTableSensor | plugins.operators.delta_table_sensor | Monitors Delta Lake table freshness — waits until a table has been updated within a given window. |
| Hook | Module | Description |
|---|---|---|
SlackWebhookHook | plugins.hooks.slack_webhook_hook | Sends formatted notifications to Slack channels via incoming webhooks. Supports blocks, attachments, and thread replies. |
TeamsWebhookHook | plugins.hooks.teams_webhook_hook | Sends adaptive card notifications to Microsoft Teams channels via incoming webhooks. Supports sections, facts, and action buttons. |
| Sensor | Module | Description |
|---|---|---|
S3KeySensorExtended | plugins.sensors.s3_key_sensor_extended | Extends the standard S3KeySensor with file size validation, age checks, and wildcard support. |
configs/connections.yamlPre-configured connection templates for common data infrastructure:
configs/variables.yamlEnvironment-aware variable templates:
configs/dag_factory_config.yamlConfiguration-driven DAG generation for teams managing many similar pipelines:
Get the full Airflow DAG Templates and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.