uranusjr commented on code in PR #56845:
URL: https://github.com/apache/airflow/pull/56845#discussion_r2472174966


##########
providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py:
##########
@@ -148,7 +148,10 @@ def _get_dagrun(dag, run_id: str, session: Session) -> 
DagRun:
         if not session:
             raise AirflowException("Session not provided.")
 
-        return session.query(DagRun).filter(DagRun.dag_id == dag.dag_id, 
DagRun.run_id == run_id).first()
+        dag_run = session.query(DagRun).filter(DagRun.dag_id == dag.dag_id, 
DagRun.run_id == run_id).first()
+        if not dag_run:
+            raise AirflowException("DagRun not found.")

Review Comment:
   This combination should be unique so let’s just use `one()` here and let 
SQLAlchemy report any exceptions for us.



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