jscheffl commented on code in PR #58101:
URL: https://github.com/apache/airflow/pull/58101#discussion_r2508290159


##########
airflow-core/src/airflow/api/common/delete_dag.py:
##########
@@ -70,13 +71,14 @@ def delete_dag(dag_id: str, keep_records_in_log: bool = 
True, session: Session =
         model for model in get_sqla_model_classes() if model.__name__ not in 
["TaskInstance", "DagRun"]
     ]
 
-    count = 0
+    count: int = 0
     for model in models_for_deletion:
         if hasattr(model, "dag_id") and (not keep_records_in_log or 
model.__name__ != "Log"):
-            result = session.execute(
+            result: Result = session.execute(
                 delete(model).where(model.dag_id == 
dag_id).execution_options(synchronize_session="fetch")
             )
-            count += result.rowcount or 0
+            cursor_result = cast("CursorResult", result)
+            count += cursor_result.rowcount

Review Comment:
   Have you considered setting the type directly to `CuresorResult` w/o needing 
to additinally `cast()`?
   ```suggestion
               result: CursorResult = session.execute(
   delete(model).where(model.dag_id == 
dag_id).execution_options(synchronize_session="fetch")
   )
               count += result.rowcount
   ```



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