mik-laj commented on a change in pull request #16842:
URL: https://github.com/apache/airflow/pull/16842#discussion_r664978929



##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -34,14 +34,14 @@
 
 
 @security.requires_access([(permissions.ACTION_CAN_READ, 
permissions.RESOURCE_DAG)])
-@provide_session
-def get_dag(dag_id, session):
+def get_dag(dag_id):
     """Get basic information about a DAG."""
-    dag = session.query(DagModel).filter(DagModel.dag_id == 
dag_id).one_or_none()
-
+    try:
+        dag: DAG = current_app.dag_bag.get_dag(dag_id)
+    except SerializedDagNotFound:
+        raise NotFound("DAG not found", detail=f"The DAG with dag_id: {dag_id} 
was not found")
     if dag is None:
         raise NotFound("DAG not found", detail=f"The DAG with dag_id: {dag_id} 
was not found")
-
     return dag_schema.dump(dag)

Review comment:
       This serializer accepts DagModel, so we should update typing on line 40 
to reflect it. See: 
https://github.com/apache/airflow/blob/fcae7a2d85b5bd1423ea904b6ef7441e33aeb988/airflow/api_connexion/schemas/dag_schema.py#L47




-- 
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]


Reply via email to