🗓️Airflow TaskFlow API
Also known as TaskFlow API, TaskFlow, Airflow @task Decorator
Airflow tasks written as plain Python code, with @task on top.
Think of it like
It is like passing a note straight to the next person in line. Nobody has to post it on a board first.
Example
Lucy writes extract and load as two functions with @task. She writes load(extract()), and Airflow runs extract first and hands its rows to load.
Why it matters
It makes a DAG read like normal Python. Passing data between tasks takes one line, not a pair of XCom calls.
Definition
Example code
python
@task
def extract():
return {"1001": 301.27}
@task
def load(rows):
print(rows)
load(extract())Common mistake
Key takeaways
- 1Plain functions. @task turns one into a task.
- 2Values flow on. Return values become inputs.
- 3Order from calls. Calling a task sets the order.