vincbeck commented on code in PR #28900:
URL: https://github.com/apache/airflow/pull/28900#discussion_r1270805170


##########
airflow/models/dag.py:
##########
@@ -1465,11 +1510,22 @@ def get_dagrun(
             raise TypeError("You must provide either the execution_date or the 
run_id")
         query = select(DagRun)
         if execution_date:
-            query = query.where(DagRun.dag_id == self.dag_id, 
DagRun.execution_date == execution_date)
+            query = query.where(DagRun.dag_id == dag_id, DagRun.execution_date 
== execution_date)
         if run_id:
-            query = query.where(DagRun.dag_id == self.dag_id, DagRun.run_id == 
run_id)
+            query = query.where(DagRun.dag_id == dag_id, DagRun.run_id == 
run_id)
         return session.scalar(query)
 
+    @provide_session
+    def get_dagrun(
+        self,
+        execution_date: datetime | None = None,
+        run_id: str | None = None,
+        session: Session = NEW_SESSION,
+    ) -> DagRun | DagRunPydantic:
+        return DAG.fetch_dagrun(
+            dag_id=self.dag_id, execution_date=execution_date, run_id=run_id, 
session=session
+        )

Review Comment:
   Done



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to