!!exclusive!! - Airflow Xcom Exclusive

Airflow XCom and Exclusive Access: A Comprehensive Guide

Troubleshooting checklist

Task C sees the last written value (non-deterministic)


Pattern A: The Return Value (The Simplest Exclusive)

Airflow automatically pushes a task’s return value as an XCom with key return_value. For exclusivity, return only a primitive or a small dictionary. airflow xcom exclusive

def extract_api_data(**context):
    # Fetch data and write to temporary location
    temp_table = f"temp_data_context['ds_nodash']"
    write_to_bigquery(temp_table)
    return temp_table  # Single string: the exclusive reference

def transform_data(table_name, **context): # table_name pulled via task_id='extract_api_data' result_table = aggregate_in_bigquery(table_name) return result_table Airflow XCom and Exclusive Access: A Comprehensive Guide