# Airflow Operator

> A ready-made Airflow template. Fill it in, and it becomes a task.

**Field:** Data Engineering  
**Category:** Orchestration  
**Also known as:** Operator (Airflow), BashOperator, PythonOperator

## Think of it like

It is like a cookie cutter. You press it once for each cookie, and each cookie is a task.

## Definition

An Airflow operator is a ready-made template for one kind of task. One runs a shell command, one runs SQL, and one copies a file to the cloud. You fill in its settings and give it a task ID. That makes a task. Add-on packages bring templates for clouds, databases and tools. A sensor is a special one that waits.

## Example

Lucy's DAG uses a SQL operator to build a table and an email operator to send the result. She writes no glue code.

## Example code

```python
from airflow.providers.standard.operators.bash import BashOperator

load = BashOperator(
    task_id="load_orders",
    bash_command="python load_orders.py",
    retries=3,
)
```

This class is the template. Give it a task_id and a command, and it becomes the load_orders task.

## Why it matters

Ready-made templates save you from writing the same code to connect again and again. A huge set of them is a big part of why Airflow spread.

## Common mistake

Writing a new template class for a one-off step. A plain Python task is often simpler.

## Three principles

- **A template.** Fill it in to make a task.
- **One job each.** Run a command, a query or a copy.
- **From providers.** Packages add operators for each service.

## Related terms

- [Airflow Task](https://learn.benibix.com/term/data/airflow-task)
- [Airflow DAG](https://learn.benibix.com/term/data/airflow-dag)
- [Sensor Task](https://learn.benibix.com/term/data/sensor-task)
- [Apache Airflow](https://learn.benibix.com/term/data/apache-airflow)
- [Airflow Hook](https://learn.benibix.com/term/data/airflow-hook)
- [Airflow Provider Package](https://learn.benibix.com/term/data/airflow-provider-package)

## Told apart from

- [Airflow Hook vs Operator](https://learn.benibix.com/compare/airflow-hook-vs-airflow-operator): People think a hook is just another kind of operator. A hook is a helper that logs in to one system and talks to it. It is not a task and never shows in the graph. An operator is a task. Many operators use a hook inside to do their work. When no operator fits, you call the hook from your own task.

![An operator box labelled BashOperator becomes a task called load_orders inside a DAG. Below it, three DAG runs for 1, 2 and 3 March each hold one task instance with its own status: success, success and running. The third run also shows an XCom carrying a file path.](https://learn.benibix.com/diagrams/airflow-operator-task.svg)

---

Source: https://learn.benibix.com/term/data/airflow-operator
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.
