]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add Query.lazy_load_from attribute for sharding
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 May 2018 17:03:14 +0000 (13:03 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Jun 2018 16:30:05 +0000 (12:30 -0400)
commita574b409296ef793cec8e1d00f1f7be48f15325e
treef79b0471f31abe95f5d73d71c35125a4bbdb210c
parent59ef300206c9973a7867098f4f6bc22985580617
Add Query.lazy_load_from attribute for sharding

Added new attribute :attr:`.Query.lazy_loaded_from` which is populated
with an :class:`.InstanceState` that is using this :class:`.Query` in
order to lazy load a relationship.  The rationale for this is that
it serves as a hint for the horizontal sharding feature to use, such that
the identity token of the state can be used as the default identity token
to use for the query within id_chooser().

Also repaired an issue in the :meth:`.Result.with_post_criteria`
method added in I899808734458e25a023142c2c5bb37cbed869479
for :ticket:`4128` where the "unbake subquery loaders" version was calling
the post crtieria functions given the :class:`.Result` as the argument
rather than applying them to the :class:`.Query`.

Change-Id: I3c0919ce7fd151b80fe2f9b5f99f60df31c2d73d
Fixes: #4243
doc/build/changelog/unreleased_12/4243.rst [new file with mode: 0644]
examples/sharding/attribute_shard.py
lib/sqlalchemy/ext/baked.py
lib/sqlalchemy/ext/horizontal_shard.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/testing/assertions.py
test/ext/test_horizontal_shard.py