]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
selectinload omit join
authorJayson Reis <santosdosreis@gmail.com>
Mon, 1 Oct 2018 16:58:46 +0000 (12:58 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Oct 2018 17:28:02 +0000 (13:28 -0400)
commit21fbb5e38f04affb8ac4502428672b3a629c2bec
treebc7742dbb9181cd42f144125c0a4bcb277b876c8
parentbb65193bffeb106e63dab535a024565d7fc2e26d
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
doc/build/changelog/migration_13.rst
doc/build/changelog/unreleased_13/4340.rst [new file with mode: 0644]
doc/build/orm/loading_relationships.rst
doc/build/orm/tutorial.rst
lib/sqlalchemy/ext/horizontal_shard.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/strategies.py
test/ext/test_horizontal_shard.py
test/orm/inheritance/test_poly_loading.py
test/orm/test_selectin_relations.py