diff --git a/airflow/api_connexion/endpoints/dag_endpoint.py b/airflow/api_connexion/endpoints/dag_endpoint.py index df68ee10d6c3a..415e414e3460a 100644 --- a/airflow/api_connexion/endpoints/dag_endpoint.py +++ b/airflow/api_connexion/endpoints/dag_endpoint.py @@ -32,7 +32,6 @@ from airflow.exceptions import AirflowException, DagNotFound from airflow.models.dag import DagModel, DagTag from airflow.security import permissions -from airflow.settings import Session from airflow.utils.session import provide_session @@ -111,15 +110,15 @@ def patch_dag(session, dag_id, update_mask=None): @security.requires_access([(permissions.ACTION_CAN_DELETE, permissions.RESOURCE_DAG)]) @provide_session -def delete_dag(dag_id: str, session: Session): +def delete_dag(dag_id: str, session): """Delete the specific DAG.""" # TODO: This function is shared with the /delete endpoint used by the web # UI, so we're reusing it to simplify maintenance. Refactor the function to # another place when the experimental/legacy API is removed. - from airflow.api.common.experimental import delete_dag + from airflow.api.common.experimental import delete_dag as delete_dag_module try: - delete_dag.delete_dag(dag_id, session=session) + delete_dag_module.delete_dag(dag_id, session=session) except DagNotFound: raise NotFound(f"Dag with id: '{dag_id}' not found") except AirflowException: diff --git a/airflow/api_connexion/schemas/dag_schema.py b/airflow/api_connexion/schemas/dag_schema.py index 8e3ed2096a859..c5c9034fff4a4 100644 --- a/airflow/api_connexion/schemas/dag_schema.py +++ b/airflow/api_connexion/schemas/dag_schema.py @@ -86,7 +86,7 @@ class DAGDetailSchema(DAGSchema): doc_md = fields.String() default_view = fields.String() params = fields.Method('get_params', dump_only=True) - tags = fields.Method("get_tags", dump_only=True) + tags = fields.Method("get_tags", dump_only=True) # type: ignore is_paused = fields.Method("get_is_paused", dump_only=True) is_active = fields.Method("get_is_active", dump_only=True)