What is Apache Airflow, and what is a DAG in it? What makes a graph a DAG, and what does a DAG file contain?
Why they ask this
The opening pair in every Airflow interview; the acyclic part and the Python-as-config part are what interviewers listen for.
Say this
Airflow is an open-source platform to author, schedule and monitor workflows as code. A DAG is a directed acyclic graph of tasks: edges point from upstream to downstream, and no path returns to its start, so every task has a defined order and the run can finish. A DAG file is Python that builds a DAG object with an id, a schedule, a start date and tasks wired with dependency operators.
The reasoning
Directed means each dependency has a direction: extract runs before load. Acyclic means no cycle: load cannot also be upstream of extract. Airflow rejects a cycle at parse time, because a cycle would never finish. The graph is the whole contract between tasks.
The file is ordinary Python, parsed by the dag processor on a loop. It instantiates `DAG(dag_id='orders_daily', schedule='@daily', start_date=datetime(2026, 1, 1))`, creates tasks from operators or `@task` functions, and wires them: `extract >> transform >> load`. Anything at module level runs every parse, so the file must be cheap.
A DAG run is one execution of the DAG for one logical date. A task instance is one task in one run. The UI, the metadata database and every log line are keyed by those three: dag_id, task_id, run.
Airflow 3, released in 2025, keeps this model and changes the machinery around it. It adds a separate API server, a dag processor, a task execution API, and `logical_date` as the one date name. The Python-as-configuration idea is what has not changed since 2015.
The answer most people give
"A DAG is the schedule." The schedule is one attribute of the DAG. The DAG is the graph of tasks and their order, and it runs on a schedule, on a trigger or on an asset update.
They’ll ask next
A DAG file calls a database at module level to build its task list. Why is that a problem, and how often does it run?
