You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: refresh Public Interface & align how-to guides for Airflow 3.0+ (#52297)
* docs: Update public interface documentation for Airflow 3.0+ for metadata direct access change
* docs: replace direct metadata model imports in how-to examples with airflow.sdk
* Make Public interface for Airflow 3 and add link for Airflow 2.11
* Fix PR comments
* Update airflow-core/docs/public-airflow-interface.rst
Co-Authored-By: Amogh Desai <[email protected]>
* Fix PR comments
* Remove duplicates and remove RuntimeTaskInstanceProtocol as it is not public
* Fix PR comments
---------
Co-authored-by: Amogh Desai <[email protected]>
Copy file name to clipboardExpand all lines: airflow-core/docs/core-concepts/params.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ If the user-supplied values don't pass validation, Airflow shows a warning inste
32
32
DAG-level Params
33
33
----------------
34
34
35
-
To add Params to a :class:`~airflow.models.dag.DAG`, initialize it with the ``params`` kwarg.
35
+
To add Params to a :class:`~airflow.sdk.DAG`, initialize it with the ``params`` kwarg.
36
36
Use a dictionary that maps Param names to either a :class:`~airflow.sdk.definitions.param.Param` or an object indicating the parameter's default value.
Copy file name to clipboardExpand all lines: airflow-core/docs/core-concepts/xcoms.rst
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,9 @@ XComs (short for "cross-communications") are a mechanism that let :doc:`tasks` t
25
25
26
26
An XCom is identified by a ``key`` (essentially its name), as well as the ``task_id`` and ``dag_id`` it came from. They can have any serializable value (including objects that are decorated with ``@dataclass`` or ``@attr.define``, see :ref:`TaskFlow arguments <concepts:arbitrary-arguments>`:), but they are only designed for small amounts of data; do not use them to pass around large values, like dataframes.
27
27
28
+
XCom operations should be performed through the Task Context using
29
+
:func:`~airflow.sdk.get_current_context`. Directly updating using XCom database model is not possible.
30
+
28
31
XComs are explicitly "pushed" and "pulled" to/from their storage using the ``xcom_push`` and ``xcom_pull`` methods on Task Instances.
29
32
30
33
To push a value within a task called **"task-1"** that will be used by another task:
@@ -73,8 +76,6 @@ An example of pushing multiple XComs and pulling them individually:
73
76
# Pulling entire xcom data from push_multiple task
74
77
data = context["ti"].xcom_pull(task_ids="push_multiple", key="return_value")
75
78
76
-
77
-
78
79
.. note::
79
80
80
81
If the first task run is not succeeded then on every retry task XComs will be cleared to make the task run idempotent.
@@ -91,7 +92,7 @@ Custom XCom Backends
91
92
92
93
The XCom system has interchangeable backends, and you can set which backend is being used via the ``xcom_backend`` configuration option.
93
94
94
-
If you want to implement your own backend, you should subclass :class:`~airflow.models.xcom.BaseXCom`, and override the ``serialize_value`` and ``deserialize_value`` methods.
95
+
If you want to implement your own backend, you should subclass :class:`~airflow.sdk.bases.xcom.BaseXCom`, and override the ``serialize_value`` and ``deserialize_value`` methods.
95
96
96
97
You can override the ``purge`` method in the ``BaseXCom`` class to have control over purging the xcom data from the custom backend. This will be called as part of ``delete``.
97
98
@@ -104,6 +105,6 @@ If you can exec into a terminal in an Airflow container, you can then print out
Copy file name to clipboardExpand all lines: airflow-core/docs/howto/connection.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Managing Connections
22
22
23
23
For an overview of hooks and connections, see :doc:`/authoring-and-scheduling/connections`.
24
24
25
-
Airflow's :class:`~airflow.models.connection.Connection` object is used for storing credentials and other information necessary for connecting to external services.
25
+
Airflow's :class:`~airflow.sdk.Connection` object is used for storing credentials and other information necessary for connecting to external services.
26
26
27
27
Connections may be defined in the following ways:
28
28
@@ -77,7 +77,7 @@ convenience property :py:meth:`~airflow.models.connection.Connection.as_json`. I
77
77
78
78
.. code-block:: pycon
79
79
80
-
>>> from airflow.models.connection import Connection
80
+
>>> from airflow.sdk import Connection
81
81
>>> c = Connection(
82
82
... conn_id="some_conn",
83
83
... conn_type="mysql",
@@ -94,7 +94,7 @@ In addition, same approach could be used to convert Connection from URI format t
94
94
95
95
.. code-block:: pycon
96
96
97
-
>>> from airflow.models.connection import Connection
0 commit comments