@@ -36,7 +36,7 @@ and extending Airflow capabilities by writing new executors, plugins, operators
36
36
Public Interface can be useful for building custom tools and integrations with other systems,
37
37
and for automating certain aspects of the Airflow workflow.
38
38
39
- In Airflow 3.0+, the primary public interface for DAG authors and task execution is the
39
+ The primary public interface for DAG Authors and task execution is using task SDK
40
40
:doc: `airflow.sdk namespace <core-concepts/taskflow >`. Direct access to the metadata database
41
41
from task code is no longer allowed. Instead, use the :doc: `Stable REST API <stable-rest-api-ref >`,
42
42
`Python Client <https://github.com/apache/airflow-client-python >`_, or Task Context methods.
@@ -74,16 +74,17 @@ way, the Stable REST API is recommended.
74
74
Using the Public Interface for DAG Authors
75
75
==========================================
76
76
77
- The primary interface for DAG authors in Airflow 3.0+ is the :doc: `airflow.sdk namespace <core-concepts/taskflow >`.
77
+ The primary interface for DAG Authors is the :doc: `airflow.sdk namespace <core-concepts/taskflow >`.
78
78
This provides a stable, well-defined interface for creating DAGs and tasks that is not subject to internal
79
79
implementation changes. The goal of this change is to decouple DAG authoring from Airflow internals (Scheduler,
80
- API Server, etc.), providing a forward-compatible , stable interface for writing and maintaining DAGs across Airflow versions.
80
+ API Server, etc.), providing a version-agnostic , stable interface for writing and maintaining DAGs across Airflow versions.
81
81
82
82
**Key Imports from airflow.sdk: **
83
83
84
84
**Classes: **
85
85
86
86
* ``Asset ``
87
+ * ``BaseHook ``
87
88
* ``BaseNotifier ``
88
89
* ``BaseOperator ``
89
90
* ``BaseOperatorLink ``
@@ -153,17 +154,17 @@ You can read more about dags in :doc:`Dags <core-concepts/dags>`.
153
154
References for the modules used in dags are here:
154
155
155
156
.. note ::
156
- The airflow.sdk namespace provides the primary interface for DAG authors in Airflow 3.0+ .
157
+ The airflow.sdk namespace provides the primary interface for DAG Authors .
157
158
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/ >`_.
158
159
159
160
.. note ::
160
161
The :class: `~airflow.models.dagbag.DagBag ` class is used internally by Airflow for loading DAGs
161
- from files and folders. DAG authors should use the :class: `~airflow.sdk.DAG ` class from the
162
+ from files and folders. DAG Authors should use the :class: `~airflow.sdk.DAG ` class from the
162
163
airflow.sdk namespace instead.
163
164
164
165
.. note ::
165
166
The :class: `~airflow.models.dagrun.DagRun ` class is used internally by Airflow for DAG run
166
- management. DAG authors should access DAG run information through the Task Context via
167
+ management. DAG Authors should access DAG run information through the Task Context via
167
168
:func: `~airflow.sdk.get_current_context ` or use the :class: `~airflow.sdk.types.DagRunProtocol `
168
169
interface.
169
170
@@ -185,7 +186,7 @@ Task Instances
185
186
Task instances are the individual runs of a single task in a DAG (in a DAG Run). They are available in the context
186
187
passed to the execute method of the operators via the :class: `~airflow.sdk.types.RuntimeTaskInstanceProtocol ` class.
187
188
188
- In Airflow 3.0+, task instances are accessed through the Task Context via :func: `~airflow.sdk.get_current_context `
189
+ Task instances are accessed through the Task Context via :func: `~airflow.sdk.get_current_context `
189
190
Direct database access is not possible. The :class: `~airflow.sdk.types.RuntimeTaskInstanceProtocol ` provides
190
191
the stable interface for task instance operations.
191
192
@@ -199,7 +200,7 @@ Task Instance Keys
199
200
Task instance keys are unique identifiers of task instances in a DAG (in a DAG Run). A key is a tuple that consists of
200
201
``dag_id ``, ``task_id ``, ``run_id ``, ``try_number ``, and ``map_index ``.
201
202
202
- In Airflow 3.0+, direct access to task instance keys via the :class: `~airflow.models.taskinstance.TaskInstance `
203
+ Direct access to task instance keys via the :class: `~airflow.models.taskinstance.TaskInstance `
203
204
model is no longer allowed from task code. Instead, use the Task Context via :func: `~airflow.sdk.get_current_context `
204
205
to access task instance information.
205
206
@@ -224,7 +225,7 @@ Example of accessing task instance information through Task Context:
224
225
225
226
.. note ::
226
227
The :class: `~airflow.models.taskinstancekey.TaskInstanceKey ` class is used internally by Airflow
227
- for identifying task instances. DAG authors should access task instance information through the
228
+ for identifying task instances. DAG Authors should access task instance information through the
228
229
Task Context via :func: `~airflow.sdk.get_current_context ` instead.
229
230
230
231
@@ -250,14 +251,14 @@ by extending them:
250
251
Public Airflow utilities
251
252
========================
252
253
253
- When writing or extending Hooks and Operators, DAG authors and developers can
254
+ When writing or extending Hooks and Operators, DAG Authors and developers can
254
255
use the following classes:
255
256
256
257
* The :class: `~airflow.sdk.Connection `, which provides access to external service credentials and configuration.
257
258
* The :class: `~airflow.sdk.Variable `, which provides access to Airflow configuration variables.
258
259
* The :class: `~airflow.sdk.execution_time.xcom.XCom ` which are used to access to inter-task communication data.
259
260
260
- In Airflow 3.0+, Connection and Variable operations should be performed through the Task Context using
261
+ Connection and Variable operations should be performed through the Task Context using
261
262
:func: `~airflow.sdk.get_current_context ` and the task instance's methods, or through the airflow.sdk namespace.
262
263
Direct database access to :class: `~airflow.models.connection.Connection ` and :class: `~airflow.models.variable.Variable `
263
264
models is no longer allowed from task code.
@@ -294,7 +295,7 @@ You can read more about the public Airflow utilities in :doc:`howto/connection`,
294
295
Reference for classes used for the utilities are here:
295
296
296
297
.. note ::
297
- Connection, Variable, and XCom classes are now part of the airflow.sdk namespace in Airflow 3.0+ .
298
+ Connection, Variable, and XCom classes are now part of the airflow.sdk namespace.
298
299
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/ >`_.
299
300
300
301
@@ -478,10 +479,10 @@ implemented in the community providers.
478
479
479
480
Decorators
480
481
==========
481
- DAG authors can use decorators to author dags using the :doc: `TaskFlow <core-concepts/taskflow >` concept.
482
+ DAG Authors can use decorators to author dags using the :doc: `TaskFlow <core-concepts/taskflow >` concept.
482
483
All Decorators derive from :class: `~airflow.sdk.bases.decorator.TaskDecorator `.
483
484
484
- The primary decorators for DAG authors are now in the airflow.sdk namespace:
485
+ The primary decorators for DAG Authors are now in the airflow.sdk namespace:
485
486
:func: `~airflow.sdk.dag `, :func: `~airflow.sdk.task `, :func: `~airflow.sdk.asset `,
486
487
:func: `~airflow.sdk.setup `, :func: `~airflow.sdk.task_group `, :func: `~airflow.sdk.teardown `,
487
488
:func: `~airflow.sdk.chain `, :func: `~airflow.sdk.chain_linear `, :func: `~airflow.sdk.cross_downstream `,
@@ -491,7 +492,7 @@ Airflow has a set of Decorators that are considered public. You are free to exte
491
492
by extending them:
492
493
493
494
.. note ::
494
- Decorators are now part of the airflow.sdk namespace in Airflow 3.0+ .
495
+ Decorators are now part of the airflow.sdk namespace.
495
496
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/ >`_.
496
497
497
498
You can read more about creating custom Decorators in :doc: `howto/create-custom-decorator `.
@@ -541,7 +542,7 @@ but in Airflow they are not parts of the Public Interface and might change any t
541
542
internal implementation detail and you should not assume they will be maintained
542
543
in a backwards-compatible way.
543
544
544
- **Direct metadata database access from task code is no longer allowed in Airflow 3.0+ **.
545
+ **Direct metadata database access from task code is no longer allowed **.
545
546
Task code cannot directly access the metadata database to query DAG state, task history,
546
547
or DAG runs. Instead, use one of the following alternatives:
547
548
0 commit comments