kaxil commented on issue #46513: URL: https://github.com/apache/airflow/issues/46513#issuecomment-2813194482
To clarify on the folks looking at this issue: The Airflow 3 behavior is correct. Here is why: In Airflow 2, `xcom_pull()` allowed pulling by just a key without specifying `task_ids`, even though the underlying DB model defines `task_id` as part of the XCom primary key. https://github.com/apache/airflow/blob/2.10.5/airflow/models/xcom.py#L82-L85 ```python dag_run_id = Column(Integer(), nullable=False, primary_key=True) task_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False, primary_key=True) map_index = Column(Integer, primary_key=True, nullable=False, server_default=text("-1")) key = Column(String(512, **COLLATION_ARGS), nullable=False, primary_key=True) ``` This leads to ambiguous and unstable behavior — for example, if two tasks push XComs with the same key (`config_blob`), `xcom_pull(key="config_blob")` would return whichever happened to come first in the query, making the result unpredictable and order-dependent. Airflow 3 addresses this inconsistency by requiring task_ids when pulling by key to reflect the task-scoped nature of XComs as enforced by the schema. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
