summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/context.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-12-27 18:14:31 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-12-27 18:14:31 +0000
commitd736f8bc4583f679167e4961f62f0fe1d318e4c4 (patch)
tree3bd7689348ee2613af38ae13bed7af99ce147940 /lib/sqlalchemy/orm/context.py
parentfd99a4aa808f91f87d0a678708dd9c2b131fda04 (diff)
parent91501e06a17d873902114275d7149ba24973db6a (diff)
downloadsqlalchemy-d736f8bc4583f679167e4961f62f0fe1d318e4c4.tar.gz
Merge "factor out UnboundLoad and rearchitect strategy_options.py" into main
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r--lib/sqlalchemy/orm/context.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index e834b22e8..f438b0b3a 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -458,7 +458,7 @@ class ORMFromStatementCompileState(ORMCompileState):
self.current_path = statement_container._compile_options._current_path
if toplevel and statement_container._with_options:
- self.attributes = {"_unbound_load_dedupes": set()}
+ self.attributes = {}
self.global_attributes = compiler._global_attributes
for opt in statement_container._with_options:
@@ -648,7 +648,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
select_statement._with_options
or select_statement._memoized_select_entities
):
- self.attributes = {"_unbound_load_dedupes": set()}
+ self.attributes = {}
for (
memoized_entities
@@ -669,9 +669,14 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
for opt in self.select_statement._with_options:
if opt._is_compile_state:
opt.process_compile_state(self)
+
else:
self.attributes = {}
+ # uncomment to print out the context.attributes structure
+ # after it's been set up above
+ # self._dump_option_struct()
+
if select_statement._with_context_options:
for fn, key in select_statement._with_context_options:
fn(self)
@@ -703,6 +708,18 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
return self
+ def _dump_option_struct(self):
+ print("\n---------------------------------------------------\n")
+ print(f"current path: {self.current_path}")
+ for key in self.attributes:
+ if isinstance(key, tuple) and key[0] == "loader":
+ print(f"\nLoader: {PathRegistry.coerce(key[1])}")
+ print(f" {self.attributes[key]}")
+ print(f" {self.attributes[key].__dict__}")
+ elif isinstance(key, tuple) and key[0] == "path_with_polymorphic":
+ print(f"\nWith Polymorphic: {PathRegistry.coerce(key[1])}")
+ print(f" {self.attributes[key]}")
+
def _setup_for_generate(self):
query = self.select_statement