uranusjr commented on code in PR #31569:
URL: https://github.com/apache/airflow/pull/31569#discussion_r1208803122
##########
airflow/api_connexion/endpoints/dag_run_endpoint.py:
##########
@@ -74,7 +74,10 @@
@provide_session
def delete_dag_run(*, dag_id: str, dag_run_id: str, session: Session =
NEW_SESSION) -> APIResponse:
"""Delete a DAG Run."""
- if session.query(DagRun).filter(DagRun.dag_id == dag_id, DagRun.run_id ==
dag_run_id).delete() == 0:
+ if (
+ session.execute(delete(DagRun).where(DagRun.dag_id == dag_id,
DagRun.run_id == dag_run_id)).rowcount
+ == 0
+ ):
Review Comment:
```suggestion
deleted_count = session.execute(delete(DagRun).where(DagRun.dag_id ==
dag_id, DagRun.run_id == dag_run_id)).rowcount
if deleted_count == 0:
```
--
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]