@@ -66,24 +66,22 @@ class User(Base):
6666 updated_at = Column (TIMESTAMP , server_default = func .now ())
6767
6868 # Relationships
69- email_verifications = relationship ("EmailVerification" , backref = "user" )
70-
7169 avatar = relationship ("Image" ,
72- lazy = "joined " ,
70+ lazy = "select " ,
7371 primaryjoin = "and_(User.id == Image.user_id, "
7472 "Image.avatar == True)" ,
7573 order_by = "desc(Image.created_at)" ,
7674 cascade = "all, delete-orphan" ,
7775 uselist = False )
7876
7977 inventory = relationship ("Item" ,
80- lazy = "joined " ,
78+ lazy = "select " ,
8179 primaryjoin = "User.id == Item.user_id" ,
8280 cascade = "all, delete-orphan" )
8381
8482 trips = relationship ("Trip" ,
8583 backref = "user" ,
86- lazy = "joined " ,
84+ lazy = "select " ,
8785 primaryjoin = "User.id == Trip.user_id" ,
8886 order_by = "desc(Trip.end_date)" ,
8987 cascade = "all, delete-orphan" )
@@ -284,10 +282,6 @@ class Post(Base):
284282 DateTime , default = datetime .datetime .utcnow , nullable = False )
285283 updated_at = Column (TIMESTAMP , server_default = func .now ())
286284
287- # Relationships
288- user = relationship ("User" , lazy = "joined" , uselist = False )
289- images = relationship ("Image" , lazy = "joined" )
290-
291285
292286class Pack (Base ):
293287 id = Column (Integer , primary_key = True , index = True )
@@ -321,12 +315,6 @@ class Trip(Base):
321315 DateTime , default = datetime .datetime .utcnow , nullable = False )
322316 updated_at = Column (TIMESTAMP , server_default = func .now ())
323317
324- # Relationships
325- conditions = relationship ("TripCondition" , lazy = "joined" )
326- geographies = relationship ("TripGeography" , lazy = "joined" )
327- images = relationship ("Image" ,
328- lazy = "joined" ,
329- order_by = "Image.sort_order" )
330318
331319
332320class Condition (Base ):
@@ -386,27 +374,18 @@ def s3(self, metadata):
386374 self .s3_url = f'{ DO_CDN } /{ s3_key } '
387375 self .s3_url_thumb = f'{ DO_CDN } /{ s3_key_thumb } '
388376
389- # Relationships
390- likes = relationship ("LikeImage" , backref = "image" )
391-
392377
393378class TripCondition (Base ):
394379 trip_id = Column (Integer , ForeignKey ("trip.id" ), primary_key = True )
395380 condition_id = Column (Integer , ForeignKey (
396381 "condition.id" ), primary_key = True )
397382
398- # Relationships
399- condition = relationship ("Condition" , lazy = "joined" )
400-
401383
402384class TripGeography (Base ):
403385 trip_id = Column (Integer , ForeignKey ("trip.id" ), primary_key = True )
404386 geography_id = Column (Integer , ForeignKey (
405387 "geography.id" ), primary_key = True )
406388
407- # Relationships
408- geography = relationship ("Geography" , lazy = "joined" )
409-
410389
411390class Comment (Base ):
412391 id = Column (Integer , primary_key = True , index = True )
@@ -420,9 +399,6 @@ class Comment(Base):
420399 DateTime , default = datetime .datetime .utcnow , nullable = False )
421400 updated_at = Column (TIMESTAMP , server_default = func .now ())
422401
423- # Relationships
424- user = relationship ("User" , lazy = "joined" , uselist = False )
425-
426402
427403class Follow (Base ):
428404 user_id = Column (Integer , ForeignKey ("user.id" ), primary_key = True )
0 commit comments