This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 382b9f67ad8 Add note on XCom pull behaviour change (#49546)
382b9f67ad8 is described below

commit 382b9f67ad849bcfb3ac905ac025d7f802c2b0ec
Author: Kaxil Naik <[email protected]>
AuthorDate: Tue Apr 22 17:00:55 2025 +0530

    Add note on XCom pull behaviour change (#49546)
    
    related: https://github.com/apache/airflow/issues/49540
    (cherry picked from commit 3ccbcff2e25acbcafcb710a200b78e29ddc7a827)
---
 RELEASE_NOTES.rst       | 35 +++++++++++++++++++++++++++++++++--
 reproducible_build.yaml |  4 ++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index 8324131e799..f5197b2973b 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -332,8 +332,11 @@ aligning with the broader asset-aware execution model 
introduced in Airflow 3.0.
 ``inlet_events`` may need to update logic that assumes the previous structure.
 
 
-Predictable Behaviour of ``xcom_pull``
-""""""""""""""""""""""""""""""""""""""
+
+Behaviour change in ``xcom_pull``
+"""""""""""""""""""""""""""""""""
+
+**Pulling without setting ``task_ids``**:
 
 In Airflow 2, the ``xcom_pull()`` method allowed pulling XComs by key without 
specifying task_ids, despite the fact that the underlying
 DB model defines task_id as part of the XCom primary key. This created 
ambiguity: if two tasks pushed XComs with the same key,
@@ -351,6 +354,34 @@ Should be updated to::
   kwargs["ti"].xcom_pull(task_ids="task1", key="key")
 
 
+**Return Type Change for Single Task ID**:
+
+In Airflow 2, when using ``xcom_pull()`` with a single task ID in a list 
(e.g., ``task_ids=["task1"]``), it would return a ``LazyXComSelectSequence``
+object containing one value. In Airflow 3.0.0, this behavior was changed to 
return the value directly.
+
+So, if you previously used:
+
+.. code-block:: python
+
+    xcom_values = kwargs["ti"].xcom_pull(task_ids=["task1"], key="key")
+    xcom_value = xcom_values[0]  # Access the first value
+
+You would now get the value directly, rather than a sequence containing one 
value.
+
+.. code-block:: python
+
+    xcom_value = kwargs["ti"].xcom_pull(task_ids=["task1"], key="key")
+
+The previous behaviour (returning list when passed a list) will be restored in 
Airflow 3.0.1 to maintain backward compatibility.
+
+However, it is recommended to be explicit about your intentions when using 
``task_ids`` (after the fix in 3.0.1):
+
+- If you want a single value, use ``task_ids="task1"``
+- If you want a sequence, use ``task_ids=["task1"]``
+
+This makes the code more explicit and easier to understand.
+
+
 Removed Configuration Keys
 """""""""""""""""""""""""""
 
diff --git a/reproducible_build.yaml b/reproducible_build.yaml
index 3ed76c96ba9..e8a278565cd 100644
--- a/reproducible_build.yaml
+++ b/reproducible_build.yaml
@@ -1,2 +1,2 @@
-release-notes-hash: 4d3a20b56440122fcbd72bf1b8c9020e
-source-date-epoch: 1745314549
+release-notes-hash: 07533055cb46f0d05c39b200665aeb61
+source-date-epoch: 1745320897

Reply via email to