]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add set_shard_id() loader option for horizontal shard
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Jan 2023 16:05:12 +0000 (11:05 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 26 Jan 2023 00:42:14 +0000 (19:42 -0500)
commit8a32f367175871500723c5ebfc0f1af1564d3478
tree90ab26593282bf30a6ac0a3b002493ebb8cb8e4f
parentd426d3bbad1d3e4a0b80e83c4423dea055609c15
add set_shard_id() loader option for horizontal shard

Added new option to horizontal sharding API
:class:`_horizontal.set_shard_id` which sets the effective shard identifier
to query against, for both the primary query as well as for all secondary
loaders including relationship eager loaders as well as relationship and
column lazy loaders.

Modernize sharding examples with new-style mappings, add new asyncio example.

Fixes: #7226
Fixes: #7028
Change-Id: Ie69248060c305e8de04f75a529949777944ad511
doc/build/changelog/unreleased_20/7226.rst [new file with mode: 0644]
doc/build/orm/extensions/horizontal_shard.rst
examples/sharding/asyncio.py [new file with mode: 0644]
examples/sharding/separate_databases.py
examples/sharding/separate_schema_translates.py
examples/sharding/separate_tables.py
lib/sqlalchemy/ext/horizontal_shard.py
lib/sqlalchemy/orm/_typing.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/testing/assertions.py
test/ext/test_horizontal_shard.py