Airflow Xcom Example 〈2K × UHD〉
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. 🧠
extract >> process
Go to Task Instance → XCom tab → See key-value pairs. airflow xcom example
extract = PythonOperator( task_id='extract_order_task', python_callable=extract_order ) 1/4 Ever needed to pass a value from
from airflow.operators.python import PythonOperator def push_func(ti): ti.xcom_push(key='result', value='hello_xcom') schedule_interval=None) as dag:
3/4 ⚠️ Warning: XCom is NOT for large data (no CSVs, no models). Keep it under 48KB. Use S3/GCS for big files.
with DAG('xcom_example', start_date=datetime(2024, 1, 1), schedule_interval=None) as dag: