Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use selectinload in trigger #40487

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions airflow/models/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import TYPE_CHECKING, Any, Iterable

from sqlalchemy import Column, Integer, String, Text, delete, func, or_, select, update
from sqlalchemy.orm import joinedload, relationship
from sqlalchemy.orm import relationship, selectinload
from sqlalchemy.sql.functions import coalesce

from airflow.api_internal.internal_api_call import internal_api_call
Expand Down Expand Up @@ -74,7 +74,7 @@ class Trigger(Base):
uselist=False,
)

task_instance = relationship("TaskInstance", back_populates="trigger", lazy="joined", uselist=False)
task_instance = relationship("TaskInstance", back_populates="trigger", lazy="selectin", uselist=False)

def __init__(
self,
Expand Down Expand Up @@ -150,7 +150,7 @@ def bulk_fetch(cls, ids: Iterable[int], session: Session = NEW_SESSION) -> dict[
select(cls)
.where(cls.id.in_(ids))
.options(
joinedload(cls.task_instance)
selectinload(cls.task_instance)
.joinedload(TaskInstance.trigger)
.joinedload(Trigger.triggerer_job)
)
Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ Seedlist
seedlist
seekable
segmentGranularity
selectin
Sendgrid
sendgrid
sentimentMax
Expand Down