diff --git a/services/core-api/app/api/incidents/models/mine_incident.py b/services/core-api/app/api/incidents/models/mine_incident.py index 9419374df1..a71d6b2067 100644 --- a/services/core-api/app/api/incidents/models/mine_incident.py +++ b/services/core-api/app/api/incidents/models/mine_incident.py @@ -129,10 +129,10 @@ class MineIncident(SoftDeleteMixin, AuditMixin, Base): lazy='selectin') # Note there is a dependency on deleted_ind in mine_documents - documents = db.relationship('MineIncidentDocumentXref', lazy='joined') + documents = db.relationship('MineIncidentDocumentXref', lazy='selectin') mine_documents = db.relationship( 'MineDocument', - lazy='joined', + lazy='selectin', secondary='mine_incident_document_xref', secondaryjoin='and_(foreign(MineIncidentDocumentXref.mine_document_guid) == remote(MineDocument.mine_document_guid),MineDocument.deleted_ind == False)' ) diff --git a/services/core-api/app/api/mines/mine/models/mine.py b/services/core-api/app/api/mines/mine/models/mine.py index d159bb7eae..b076de4554 100644 --- a/services/core-api/app/api/mines/mine/models/mine.py +++ b/services/core-api/app/api/mines/mine/models/mine.py @@ -56,7 +56,7 @@ class Mine(SoftDeleteMixin, AuditMixin, Base): 'MineTailingsStorageFacility', backref='mine', order_by='desc(MineTailingsStorageFacility.update_timestamp)', - lazy='joined') + lazy='selectin') # Almost always used, but faster to use selectin to load related data _permit_identities = db.relationship(