summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/shard.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-09-26 17:08:19 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-09-26 17:08:19 +0000
commit3e672bbfc8d284b58208987d5fb858e424d02111 (patch)
treef0ddef9742f0a25f93922cdb429dec68e3139e10 /lib/sqlalchemy/orm/shard.py
parent9d16ae440b416358b469e6881f1203095233c37c (diff)
downloadsqlalchemy-3e672bbfc8d284b58208987d5fb858e424d02111.tar.gz
- created a link between QueryContext and SelectionContext; the attribute
dictionary of QueryContext is now passed to SelectionContext inside of Query.instances(), allowing messages to be passed between the two stages. - removed the recent "exact match" behavior of Alias objects, they're back to their usual behavior. - tightened up the relationship between the Query's generation of "eager load" aliases, and Query.instances() which actually grabs the eagerly loaded rows. If the aliases were not specifically generated for that statement by EagerLoader, the EagerLoader will not take effect when the rows are fetched. This prevents columns from being grabbed accidentally as being part of an eager load when they were not meant for such, which can happen with textual SQL as well as some inheritance situations. It's particularly important since the "anonymous aliasing" of columns uses simple integer counts now to generate labels.
Diffstat (limited to 'lib/sqlalchemy/orm/shard.py')
-rw-r--r--lib/sqlalchemy/orm/shard.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/shard.py b/lib/sqlalchemy/orm/shard.py
index 48e057966..c38bcdd96 100644
--- a/lib/sqlalchemy/orm/shard.py
+++ b/lib/sqlalchemy/orm/shard.py
@@ -78,19 +78,19 @@ class ShardedQuery(Query):
q._shard_id = shard_id
return q
- def _execute_and_instances(self, statement):
+ def _execute_and_instances(self, context):
if self._shard_id is not None:
- result = self.session.connection(mapper=self.mapper, shard_id=self._shard_id).execute(statement, **self._params)
+ result = self.session.connection(mapper=self.mapper, shard_id=self._shard_id).execute(context.statement, **self._params)
try:
- return iter(self.instances(result))
+ return iter(self.instances(result, querycontext=context))
finally:
result.close()
else:
partial = []
for shard_id in self.query_chooser(self):
- result = self.session.connection(mapper=self.mapper, shard_id=shard_id).execute(statement, **self._params)
+ result = self.session.connection(mapper=self.mapper, shard_id=shard_id).execute(context.statement, **self._params)
try:
- partial = partial + list(self.instances(result))
+ partial = partial + list(self.instances(result, querycontext=context))
finally:
result.close()
# if some kind of in memory 'sorting' were done, this is where it would happen