diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-23 17:03:19 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-23 17:03:19 -0500 |
| commit | de725a0a4daea48fa4d6ffff892620e93c358b5e (patch) | |
| tree | 22d686c001f0046fb266599cd9a0d507bf6a1da2 /lib/sqlalchemy | |
| parent | e6855d3f77ae5f3467564982318416bd2e758eb3 (diff) | |
| download | sqlalchemy-de725a0a4daea48fa4d6ffff892620e93c358b5e.tar.gz | |
- Horizontal shard query places 'shard_id' in
context.attributes where it's accessible by the
"load()" event. [ticket:2031]
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/ext/horizontal_shard.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py index 41fae8e7b..926c029d0 100644 --- a/lib/sqlalchemy/ext/horizontal_shard.py +++ b/lib/sqlalchemy/ext/horizontal_shard.py @@ -95,6 +95,7 @@ class ShardedQuery(Query): def _execute_and_instances(self, context): if self._shard_id is not None: + context.attributes['shard_id'] = self._shard_id result = self.session.connection( mapper=self._mapper_zero(), shard_id=self._shard_id).execute(context.statement, self._params) @@ -102,6 +103,7 @@ class ShardedQuery(Query): else: partial = [] for shard_id in self.query_chooser(self): + context.attributes['shard_id'] = shard_id result = self.session.connection( mapper=self._mapper_zero(), shard_id=shard_id).execute(context.statement, self._params) |
