summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/loading.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-04-20 14:09:51 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-04-20 14:11:44 -0400
commit4b9e2db51a7e40ff2c4212fe8476fe0c7ba21ca0 (patch)
tree326cb26f0c267be96a23a20432f313b566045215 /lib/sqlalchemy/orm/loading.py
parent3580e6ed33451505e2462ffcb1beaf96f851b011 (diff)
downloadsqlalchemy-4b9e2db51a7e40ff2c4212fe8476fe0c7ba21ca0.tar.gz
Allow immediateload to use_get for recursive call
Altered some of the behavior repaired in :ticket:`6232` where the ``immediateload`` loader strategy no longer goes into recursive loops; the modification is that an eager load (joinedload, selectinload, or subqueryload) from A->bs->B which then states ``immediateload`` for a simple manytoone B->a->A that's in the identity map will populate the B->A, so that this attribute is back-populated when the collection of A/A.bs are loaded. This allows the objects to be functional when detached. Fixes: #6301 Change-Id: I8505d851802c38ad8ad4e2fab9030f7c17089e9d
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r--lib/sqlalchemy/orm/loading.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index ea6d0f1fe..cd2ec8301 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -338,7 +338,9 @@ def get_from_identity(session, mapper, key, passive):
return attributes.PASSIVE_NO_RESULT
elif not passive & attributes.RELATED_OBJECT_OK:
# this mode is used within a flush and the instance's
- # expired state will be checked soon enough, if necessary
+ # expired state will be checked soon enough, if necessary.
+ # also used by immediateloader for a mutually-dependent
+ # o2m->m2m load, :ticket:`6301`
return instance
try:
state._load_expired(state, passive)