diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-13 11:17:09 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2023-02-16 00:09:18 +0000 |
commit | 3fd081d070716fd5fc578555f945d503f9a91f91 (patch) | |
tree | 9becb3d07de9e69cc1681f19e7f11ab71268e506 /lib/sqlalchemy/orm/context.py | |
parent | 8855656626202e541bd2c95bc023e820a022322f (diff) | |
download | sqlalchemy-3fd081d070716fd5fc578555f945d503f9a91f91.tar.gz |
immediateload lazy relationships named in refresh.attribute_names
The :meth:`_orm.Session.refresh` method will now immediately load a
relationship-bound attribute that is explicitly named within the
:paramref:`_orm.Session.refresh.attribute_names` collection even if it is
currently linked to the "select" loader, which normally is a "lazy" loader
that does not fire off during a refresh. The "lazy loader" strategy will
now detect that the operation is specifically a user-initiated
:meth:`_orm.Session.refresh` operation which named this attribute
explicitly, and will then call upon the "immediateload" strategy to
actually emit SQL to load the attribute. This should be helpful in
particular for some asyncio situations where the loading of an unloaded
lazy-loaded attribute must be forced, without using the actual lazy-loading
attribute pattern not supported in asyncio.
Fixes: #9298
Change-Id: I9b50f339bdf06cdb2ec98f8e5efca2b690895dd7
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index e6f14daad..2b45b5adc 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -141,6 +141,7 @@ class QueryContext: _lazy_loaded_from = None _legacy_uniquing = False _sa_top_level_orm_context = None + _is_user_refresh = False def __init__( self, |