Example — Airflow Xcom

1/4 Ever needed to pass a value from one Airflow task to another? → Use (Cross-Communication). Think of it as a mini shared dictionary for your DAG run. 🧠

Title: Mastering Data Sharing in Airflow: XComs Explained with a Real Example

extract >> process

Use return as a shortcut – return value auto-pushes to return_value key.

One of the most common questions when building DAGs is: 👉 "How do I pass data from one task to another?" airflow xcom example

push = PythonOperator(task_id='push_task', python_callable=push_func) pull = PythonOperator(task_id='pull_task', python_callable=pull_func)

from airflow.operators.python import PythonOperator def push_func(ti): ti.xcom_push(key='result', value='hello_xcom') 1/4 Ever needed to pass a value from

def auto_push(): return "auto_xcom" # automatically in XCom