From f2fb40721679002d9a1028c16efdc437cc9ac154 Mon Sep 17 00:00:00 2001 From: Aditi Anand Date: Wed, 24 Apr 2024 16:35:03 -0400 Subject: [PATCH] adding back a removed comment while sqlalchemy 2.0 upgrade --- app/dao/users_dao.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/dao/users_dao.py b/app/dao/users_dao.py index ab958f2e5..58b660aba 100644 --- a/app/dao/users_dao.py +++ b/app/dao/users_dao.py @@ -191,6 +191,8 @@ def get_user_and_accounts(user_id): return ( User.query.filter(User.id == user_id) .options( + # eagerly load the user's services and organizations, and also the service's org and vice versa + # (so we can see if the user knows about it) joinedload(User.services).joinedload(Service.organization), joinedload(User.organizations).subqueryload(Organization.services), )