Skip to content

Commit 8c27d43

Browse files
committed
Added docs on eager loading
1 parent cb85e61 commit 8c27d43

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packet/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class Packet(db.Model):
5555
info_achieve = Column(Text, nullable=True) # Used to fulfil the technical achievements list requirement
5656

5757
freshman = relationship("Freshman", back_populates="packets")
58+
59+
# The `lazy="subquery"` kwarg enables eager loading for signatures which makes signature calculations much faster
60+
# See the docs here for details: https://docs.sqlalchemy.org/en/latest/orm/loading_relationships.html
5861
upper_signatures = relationship("UpperSignature", lazy="subquery",
5962
order_by="UpperSignature.signed.desc(), UpperSignature.updated")
6063
fresh_signatures = relationship("FreshSignature", lazy="subquery",

0 commit comments

Comments
 (0)