# Airflow DAG

> One Airflow pipeline. It is a Python file with tasks, arrows and a time to run.

**Field:** Data Engineering  
**Category:** Orchestration  
**Also known as:** DAG File, Directed Acyclic Graph (Airflow)

## Think of it like

It is like a recipe card. It lists the steps, which ones come first, and when to cook.

## Definition

An Airflow DAG is one pipeline, written as a Python file. DAG stands for directed acyclic graph: tasks joined by one-way arrows, with no loops. The file names the tasks and the arrows between them. It also sets the schedule and the start date. Airflow reads the file and shows the graph on its web page.

## Example

Jack's daily_sales DAG has four tasks. He opens the web page each morning and sees four green boxes.

## 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()
```

A two-task DAG in Airflow 3. Passing extract into load is what draws the arrow between them.

## 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.

## Common mistake

Using one giant DAG for everything. When one part breaks, the whole thing stops, and nobody can rerun just their piece.

## Three principles

- **One pipeline.** A DAG is one workflow in one file.
- **One-way arrows.** Tasks point forward, never in a loop.
- **Own schedule.** Each DAG says when it runs.

## Related terms

- [Apache Airflow](https://learn.benibix.com/term/data/apache-airflow)
- [Airflow Task](https://learn.benibix.com/term/data/airflow-task)
- [Task Dependency](https://learn.benibix.com/term/data/task-dependency)
- [Airflow DAG Run](https://learn.benibix.com/term/data/airflow-dag-run)
- [Airflow Catchup](https://learn.benibix.com/term/data/airflow-catchup)
- [Airflow TaskFlow API](https://learn.benibix.com/term/data/airflow-taskflow-api)
- [Airflow Task Group](https://learn.benibix.com/term/data/airflow-task-group)

## Told apart from

- [Airflow DAG vs DAG Run](https://learn.benibix.com/compare/airflow-dag-vs-airflow-dag-run): People say DAG when they mean one run of it, and the two are not the same. An Airflow DAG is the pipeline itself: a Python file with tasks, arrows and a schedule. A DAG run is one time that pipeline ran, tied to one date of data. One daily DAG makes 365 runs a year, and each run can pass or fail on its own.

![Five tasks joined by arrows: extract orders and extract payments both feed a join task, which feeds build report and then email team. The join task is highlighted as failed, with a loop arrow labelled retry 2 of 3.](https://learn.benibix.com/diagrams/orchestration-dag.svg)

---

Source: https://learn.benibix.com/term/data/airflow-dag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
