def pull_function(**context): value = context['ti'].xcom_pull(key='message', task_ids='push_task') print(f"Received: value")
Passing a small JSON object or an ID from a web request. ❌ What to Avoid xcom airflow
push >> pull
XCom (short for "cross-communication") is a built-in Airflow feature that facilitates data exchange between tasks. It provides a way for tasks to push and pull data, making it possible for them to communicate with each other. XCom is particularly useful when tasks need to share information, such as: def pull_function(**context): value = context['ti']
In this example, task1 pushes the string "Hello, World!" to XCOM with the key greeting . task2 then pulls the data from XCOM using the same key and prints it. such as: In this example