What is a DAG in Apache Airflow?
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- Apache Airflow
- versions
- Apache Airflow 2.x, Apache Airflow 3.x
- os
- any
A DAG (directed acyclic graph) is the unit of work in Apache Airflow: a set of tasks connected by dependencies that only point forward, so the graph has no cycles. The DAG also carries a schedule; for each scheduled interval Airflow creates a DAG run and executes the tasks in dependency order.
Example
from datetime import datetime
from airflow.sdk import dag, task # Airflow 3; in Airflow 2: from airflow.decorators import dag, task
@dag(schedule="@daily", start_date=datetime(2026, 1, 1), catchup=False)
def daily_report():
@task
def extract():
return [3, 1, 2]
@task
def transform(rows):
return sorted(rows)
@task
def load(rows):
print(rows)
load(transform(extract())) # extract >> transform >> load
daily_report()Terms around a DAG
| Term | Meaning |
|---|---|
| Task | one node of the DAG: an operator, a sensor or a @task function |
| Dependency | an edge: a >> b means b runs after a succeeds (by default) |
| DAG run | one execution of the DAG for a logical date or a manual trigger |
| Task instance | one execution of one task inside a DAG run |
| schedule | cron expression, preset (@daily) or a timetable / asset trigger |
| catchup | whether to create runs for past intervals since start_date |
"Acyclic" is a hard rule: Airflow refuses to load a DAG file whose dependencies form a cycle, and reports the problem as an import error in the UI.
Sources
Related pages
codes · kafkaKafka error codes: UNKNOWN_TOPIC_OR_PARTITION, NOT_LEADER and moreKafka protocol error codes explained: 3 UNKNOWN_TOPIC_OR_PARTITION, 6 NOT_LEADER_OR_FOLLOWER, 10 MESSAGE_TOO_LARGE, 19 NOT_ENOUGH_REPLICAS and others.cheat sheets · pandaspandas cheat sheet: read, select, filter, group and reshapepandas cheat sheet: read CSV and Parquet, select with loc and iloc, filter rows, add columns, group and aggregate, pivot, handle missing values and write files.compat · numpyNumPy versions and supported Python versions (2.0 to 2.5)Python versions supported by each NumPy release: 2.0 runs on 3.9-3.12, 2.1 and 2.2 on 3.10-3.13, 2.4 on 3.11-3.14 and 2.5 on 3.12-3.14, per the release notes.