]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Use expanding IN for all literal value IN expressions
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 9 Dec 2019 23:05:00 +0000 (18:05 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Dec 2019 16:31:13 +0000 (11:31 -0500)
commit60e7034a7423955cd89d5624f8769d3804ca6d82
tree027fd963fc073970b9ab62ae7f389e61192b1992
parentc6554ac52bfb7ce9ecd30ec777ce90adfe7861d2
Use expanding IN for all literal value IN expressions

The "expanding IN" feature, which generates IN expressions at query
execution time which are based on the particular parameters associated with
the statement execution, is now used for all IN expressions made against
lists of literal values.   This allows IN expressions to be fully cacheable
independently of the list of values being passed, and also includes support
for empty lists. For any scenario where the IN expression contains
non-literal SQL expressions, the old behavior of pre-rendering for each
position in the IN is maintained. The change also completes support for
expanding IN with tuples, where previously type-specific bind processors
weren't taking effect.

As part of this change, a more explicit separation between
"literal execute" and "post compile" bound parameters is being made;
as the "ansi bind rules" feature is rendering bound parameters
inline, as we now support "postcompile" generically, these should
be used here, however we have to render literal values at
execution time even for "expanding" parameters.  new test fixtures
etc. are added to assert everything goes to the right place.

Fixes: #4645
Change-Id: Iaa2b7bfbfaaf5b80799ee17c9b8507293cba6ed1
28 files changed:
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/4645.rst [new file with mode: 0644]
examples/sharding/attribute_shard.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/engine/create.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/operators.py
lib/sqlalchemy/testing/assertions.py
test/dialect/mssql/test_compiler.py
test/dialect/test_sqlite.py
test/engine/test_deprecations.py
test/ext/declarative/test_mixin.py
test/ext/test_horizontal_shard.py
test/orm/inheritance/test_relationship.py
test/orm/inheritance/test_single.py
test/orm/test_deferred.py
test/orm/test_froms.py
test/orm/test_of_type.py
test/orm/test_query.py
test/orm/test_selectin_relations.py
test/sql/test_compare.py
test/sql/test_compiler.py
test/sql/test_operators.py
test/sql/test_query.py
test/sql/test_selectable.py