]> 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:51 +0000 (14:23 -0500)
commit219bcb3a77edd72ef8fc36c8ded921d6fb9a34a5
tree9cf90f8d576bafdc88c999e387047f89feb72263
parentda0a3e1c3ec200cf489697f179559fa490bbd01a
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
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