summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext
diff options
context:
space:
mode:
authorJayson Reis <santosdosreis@gmail.com>2018-10-01 12:58:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-10-10 13:28:02 -0400
commit21fbb5e38f04affb8ac4502428672b3a629c2bec (patch)
treebc7742dbb9181cd42f144125c0a4bcb277b876c8 /lib/sqlalchemy/ext
parentbb65193bffeb106e63dab535a024565d7fc2e26d (diff)
downloadsqlalchemy-21fbb5e38f04affb8ac4502428672b3a629c2bec.tar.gz
selectinload omit join
The "selectin" loader strategy now omits the JOIN in the case of a simple one-to-many load, where it instead relies upon the foreign key columns of the related table in order to match up to primary keys in the parent table. This optimization can be disabled by setting the :paramref:`.relationship.omit_join` flag to False. Many thanks to Jayson Reis for the efforts on this. As part of this change, horizontal shard no longer relies upon the _mapper_zero() method to get the query-bound mapper, instead using the more generalized _bind_mapper() (which will use mapper_zero if no explicit FROM is present). A short check for the particular recursive condition is added to BundleEntity and it no longer assigns itself as the "namespace" to its ColumnEntity objects which creates a reference cycle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #4340 Change-Id: I649587e1c07b684ecd63f7d10054cd165891baf4 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/7
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r--lib/sqlalchemy/ext/horizontal_shard.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py
index 425d28963..f86e4fc93 100644
--- a/lib/sqlalchemy/ext/horizontal_shard.py
+++ b/lib/sqlalchemy/ext/horizontal_shard.py
@@ -45,7 +45,7 @@ class ShardedQuery(Query):
def iter_for_shard(shard_id):
context.attributes['shard_id'] = context.identity_token = shard_id
result = self._connection_from_session(
- mapper=self._mapper_zero(),
+ mapper=self._bind_mapper(),
shard_id=shard_id).execute(
context.statement,
self._params)