summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/strategies.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-06-04 17:29:20 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-10-01 16:52:24 -0400
commitcc718cccc0bf8a01abdf4068c7ea4f32c9322af6 (patch)
treee839526dd0ab64bf0d8babe01006e03987403a66 /lib/sqlalchemy/orm/strategies.py
parenta3c964203e61f8deeb559b15a78cc640dee67012 (diff)
downloadsqlalchemy-cc718cccc0bf8a01abdf4068c7ea4f32c9322af6.tar.gz
Run row value processors up front
as part of a larger series of changes to generalize row-tuples, RowProxy becomes plain Row and is no longer a "proxy"; the DBAPI row is now copied directly into the Row when constructed, result handling occurs at once. Subsequent changes will break out Row into a new version that behaves fully a tuple. Change-Id: I2ffa156afce5d21c38f28e54c3a531f361345dd5
Diffstat (limited to 'lib/sqlalchemy/orm/strategies.py')
-rw-r--r--lib/sqlalchemy/orm/strategies.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index 1f2f65728..d8e5997c1 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -1383,20 +1383,20 @@ class SubqueryLoader(PostLoader):
if self.uselist:
self._create_collection_loader(
- context, collections, local_cols, populators
+ context, result, collections, local_cols, populators
)
else:
self._create_scalar_loader(
- context, collections, local_cols, populators
+ context, result, collections, local_cols, populators
)
def _create_collection_loader(
- self, context, collections, local_cols, populators
+ self, context, result, collections, local_cols, populators
):
+ tuple_getter = result._tuple_getter(local_cols)
+
def load_collection_from_subq(state, dict_, row):
- collection = collections.get(
- tuple([row[col] for col in local_cols]), ()
- )
+ collection = collections.get(tuple_getter(row), ())
state.get_impl(self.key).set_committed_value(
state, dict_, collection
)
@@ -1414,12 +1414,12 @@ class SubqueryLoader(PostLoader):
populators["eager"].append((self.key, collections.loader))
def _create_scalar_loader(
- self, context, collections, local_cols, populators
+ self, context, result, collections, local_cols, populators
):
+ tuple_getter = result._tuple_getter(local_cols)
+
def load_scalar_from_subq(state, dict_, row):
- collection = collections.get(
- tuple([row[col] for col in local_cols]), (None,)
- )
+ collection = collections.get(tuple_getter(row), (None,))
if len(collection) > 1:
util.warn(
"Multiple rows returned with "