🗓️Airflow DAG
Also known as DAG File, Directed Acyclic Graph (Airflow)
One Airflow pipeline. It is a Python file with tasks, arrows and a time to run.
Think of it like
It is like a recipe card. It lists the steps, which ones come first, and when to cook.
Example
Jack's daily_sales DAG has four tasks. He opens the web page each morning and sees four green boxes.
Why it matters
The DAG is the unit you build, schedule, pause and rerun. Getting its shape right decides how fast and safe the pipeline is.
Definition
Example code
python
from datetime import datetime
from airflow.sdk import dag, task
@dag(schedule="@daily", start_date=datetime(2026, 1, 1))
def daily_sales():
@task
def extract():
return [1, 2, 3]
@task
def load(rows):
print(len(rows), "rows")
load(extract())
daily_sales()Common mistake
Key takeaways
- 1One pipeline. A DAG is one workflow in one file.
- 2One-way arrows. Tasks point forward, never in a loop.
- 3Own schedule. Each DAG says when it runs.