From 71a3ccbdef0d88e9231b7de9c51e4ed60b3b7181 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 5 Aug 2020 17:58:48 -0400 Subject: Convert lazy loader, selectinload, load_on_ident to lambda statements Building on newly robust lambdas in I29a513c98917b1d503abfdd61e6b6e8800851aa8, convert key loading off of the "baked" system so that baked is no longer used by the ORM. Change-Id: I3abfb45dd6e50f84f29d39434caa0b550ce27864 --- lib/sqlalchemy/orm/context.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/orm/context.py') diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 55a6b4cd2..96725e55b 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -46,6 +46,7 @@ class QueryContext(object): __slots__ = ( "compile_state", "query", + "params", "load_options", "bind_arguments", "execution_options", @@ -83,6 +84,7 @@ class QueryContext(object): self, compile_state, statement, + params, session, load_options, execution_options=None, @@ -96,6 +98,7 @@ class QueryContext(object): self.session = session self.loaders_require_buffering = False self.loaders_require_uniquing = False + self.params = params self.propagated_loader_options = { o for o in statement._with_options if o.propagate_to_loaders @@ -239,7 +242,13 @@ class ORMCompileState(CompileState): @classmethod def orm_setup_cursor_result( - cls, session, statement, execution_options, bind_arguments, result + cls, + session, + statement, + params, + execution_options, + bind_arguments, + result, ): execution_context = result.context compile_state = execution_context.compiled.compile_state @@ -256,6 +265,7 @@ class ORMCompileState(CompileState): querycontext = QueryContext( compile_state, statement, + params, session, load_options, execution_options, @@ -711,7 +721,9 @@ class ORMSelectCompileState(ORMCompileState, SelectState): and "entity_namespace" in element._annotations ): for elem in _select_iterables( - element._annotations["entity_namespace"].columns + element._annotations[ + "entity_namespace" + ]._all_column_expressions ): yield elem else: -- cgit v1.2.1