dstandish commented on code in PR #27758:
URL: https://github.com/apache/airflow/pull/27758#discussion_r1060291831


##########
airflow/models/trigger.py:
##########
@@ -87,7 +89,15 @@ def bulk_fetch(cls, ids: Iterable[int], session=None) -> 
dict[int, Trigger]:
         Fetches all of the Triggers by ID and returns a dict mapping
         ID -> Trigger instance
         """
-        return {obj.id: obj for obj in 
session.query(cls).filter(cls.id.in_(ids)).all()}
+        return {
+            obj.id: obj
+            for obj in session.query(cls)
+            .filter(cls.id.in_(ids))
+            .options(joinedload("task_instance"))
+            .options(joinedload("task_instance.trigger"))
+            .options(joinedload("task_instance.trigger.triggerer_job"))

Review Comment:
   yeah we could do.. i guess the one thing i was fuzzy about is... does it 
make it an inner join -- here it doesn't matter since the rows are all there... 
but  i guess we add `isouter=True` and should work i can try if you think good 
idea.
   
   but i guess it would be marginally more costly ... not sure how much



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