summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/loading.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-26 18:50:05 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-08-23 12:46:41 -0400
commit2fc7078a08db057ea7e43991205aaee5562d7fd3 (patch)
treefb4f227072d50d8e493b988832fc0b4c2771664b /lib/sqlalchemy/orm/loading.py
parente429ef1d31343b99e885f58a79800ae490155294 (diff)
downloadsqlalchemy-2fc7078a08db057ea7e43991205aaee5562d7fd3.tar.gz
Run eager loaders on unexpire
Eager loaders, such as joined loading, SELECT IN loading, etc., when configured on a mapper or via query options will now be invoked during the refresh on an expired object; in the case of selectinload and subqueryload, since the additional load is for a single object only, the "immediateload" scheme is used in these cases which resembles the single-parent query emitted by lazy loading. Change-Id: I7ca2c77bff58dc21015d60093a88c387937376b2 Fixes: #1763
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r--lib/sqlalchemy/orm/loading.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index fd283f432..f07067d17 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -269,6 +269,10 @@ def load_on_pk_identity(
else:
version_check = False
+ if refresh_state and refresh_state.load_options:
+ q = q._with_current_path(refresh_state.load_path.parent)
+ q = q._conditional_options(refresh_state.load_options)
+
q._get_options(
populate_existing=bool(refresh_state),
version_check=version_check,