Airflow Xcom Exclusive -

To understand when XCom is appropriate, compare it to other Airflow features:

| Feature | Use Case | Persistence | | :--- | :--- | :--- | | XCom | Passing dynamic data between specific tasks within a DAG run. | Persists for the duration of the DAG run (usually cleaned up eventually). | | Variables | Storing static configuration or global settings (e.g., API keys, environment names). | Persists globally until manually deleted. | | External Storage | Moving large datasets (files, large DataFrames). | Persists until externally deleted. | airflow xcom exclusive

XComs are a mechanism for passing arbitrary data between tasks. To understand when XCom is appropriate, compare it

@task
def multi_push(**context):
    context['ti'].xcom_push(key='count', value=100)
    context['ti'].xcom_push(key='status', value='ok')
    return "main_return"   # goes to default XCom key 'return_value'

@task def multi_pull(**context): count = context['ti'].xcom_pull(key='count', task_ids='multi_push') status = context['ti'].xcom_pull(key='status', task_ids='multi_push') main = context['ti'].xcom_pull(task_ids='multi_push') # default key | Persists globally until manually deleted