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


##########
airflow/models/trigger.py:
##########
@@ -121,17 +121,24 @@ def clean_unused(cls, session: Session = NEW_SESSION) -> 
None:
         # Update all task instances with trigger IDs that are not DEFERRED to 
remove them
         for attempt in run_with_db_retries():
             with attempt:
-                session.query(TaskInstance).filter(
-                    TaskInstance.state != TaskInstanceState.DEFERRED, 
TaskInstance.trigger_id.isnot(None)
-                ).update({TaskInstance.trigger_id: None})
+                session.execute(
+                    update(TaskInstance)
+                    .where(
+                        TaskInstance.state != TaskInstanceState.DEFERRED, 
TaskInstance.trigger_id.isnot(None)

Review Comment:
   ```suggestion
                           TaskInstance.state != TaskInstanceState.DEFERRED, 
TaskInstance.trigger_id.is_not(None)
   ```
   
   `isnot` is not formally deprecated but `is_not` is favored



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