]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
harden typing / coercion for on conflict/on duplicate key
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Dec 2024 16:24:58 +0000 (11:24 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Dec 2024 19:23:58 +0000 (14:23 -0500)
commitca592bb8a096fb197f3ece348273a76dd4d6c9a2
tree927425558aa22989a8293626b95efc67cd69ced7
parentf7e3f811d4d85b6cc755b8ea0afe2eab54f5f8f5
harden typing / coercion for on conflict/on duplicate key

in 2.1 we want these structures to be cacheable, so start
by cleaning up types and adding coercions to enforce those types.
these will be more locked down in 2.1 as we will need to move
bound parameter coercion outside of compilation, but here
do some small starts and introduce in 2.0.

in one interest of cachability, a "literal_binds" that found
its way into SQLite's compiler is replaced with "literal_execute",
the difference being that the latter is cacheable.   This literal
is apparently necessary to suit SQLite's query planner for
the "index criteria" portion of the on conflict clause that otherwise
can't work with a real bound parameter.

Change-Id: I4d66ec1473321616a1707da324a7dfe7a61ec94e
(cherry picked from commit 219bcb3a77edd72ef8fc36c8ded921d6fb9a34a5)
12 files changed:
lib/sqlalchemy/dialects/_typing.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/dml.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/postgresql/dml.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/dialects/sqlite/dml.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/schema.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_on_conflict.py
test/dialect/test_sqlite.py