summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/default.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-03-07 12:48:13 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-03-07 17:18:31 -0500
commitb3d3795de0d45fe4adda7393881f0f955409a45d (patch)
treee1ed366f07f596388cfca024ae20128131565f61 /lib/sqlalchemy/engine/default.py
parent0a1f720355f02d38da2a5a8444712dd7d199c713 (diff)
downloadsqlalchemy-positional_targeting.tar.gz
- The SQL compiler now generates the mapping of expected columnspositional_targeting
such that they are matched to the received result set positionally, rather than by name. Originally, this was seen as a way to handle cases where we had columns returned with difficult-to-predict names, though in modern use that issue has been overcome by anonymous labeling. In this version, the approach basically reduces function call count per-result by a few dozen calls, or more for larger sets of result columns. The approach still degrades into a modern version of the old approach if textual elements modify the result map, or if any discrepancy in size exists between the compiled set of columns versus what was received, so there's no issue for partially or fully textual compilation scenarios where these lists might not line up. fixes #918 - callcounts still need to be adjusted down for this so zoomark tests won't pass at the moment
Diffstat (limited to 'lib/sqlalchemy/engine/default.py')
-rw-r--r--lib/sqlalchemy/engine/default.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 17d2e2531..9d2bbfb15 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -461,9 +461,9 @@ class DefaultExecutionContext(interfaces.ExecutionContext):
is_crud = False
isddl = False
executemany = False
- result_map = None
compiled = None
statement = None
+ _result_columns = None
_is_implicit_returning = False
_is_explicit_returning = False
@@ -525,7 +525,7 @@ class DefaultExecutionContext(interfaces.ExecutionContext):
# compiled clauseelement. process bind params, process table defaults,
# track collections used by ResultProxy to target and process results
- self.result_map = compiled.result_map
+ self._result_columns = compiled._result_columns
self.unicode_statement = util.text_type(compiled)
if not dialect.supports_unicode_statements:
@@ -663,6 +663,13 @@ class DefaultExecutionContext(interfaces.ExecutionContext):
self.cursor = self.create_cursor()
return self
+ @property
+ def result_map(self):
+ if self._result_columns:
+ return self.compiled.result_map
+ else:
+ return None
+
@util.memoized_property
def engine(self):
return self.root_connection.engine