]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
remove sentinel_value_resolvers and use pre-bind values
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Mar 2024 14:51:02 +0000 (10:51 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 18 Mar 2024 14:04:06 +0000 (10:04 -0400)
commit4c0af9e93dab62a04aa00f7c9a07c984e0e316df
treec9503110ff40a26b5df09bf5681424ec82bf3633
parente3f7bc683ac3ea6d7c517b9c7ffeaa911860d732
remove sentinel_value_resolvers and use pre-bind values

Made a change to the adjustment made in version 2.0.10 for :ticket:`9618`,
which added the behavior of reconciling RETURNING rows from a bulk INSERT
to the parameters that were passed to it.  This behavior included a
comparison of already-DB-converted bound parameter values against returned
row values that was not always "symmetrical" for SQL column types such as
UUIDs, depending on specifics of how different DBAPIs receive such values
versus how they return them, necessitating the need for additional
"sentinel value resolver" methods on these column types.  Unfortunately
this broke third party column types such as UUID/GUID types in libraries
like SQLModel which did not implement this special method, raising an error
"Can't match sentinel values in result set to parameter sets".  Rather than
attempt to further explain and document this implementation detail of the
"insertmanyvalues" feature including a public version of the new
method, the approach is intead revised to no longer need this extra
conversion step, and the logic that does the comparison now works on the
pre-converted bound parameter value compared to the post-result-processed
value, which should always be of a matching datatype.  In the unusual case
that a custom SQL column type that also happens to be used in a "sentinel"
column for bulk INSERT is not receiving and returning the same value type,
the "Can't match" error will be raised, however the mitigation is
straightforward in that the same Python datatype should be passed as that
returned.

Fixes: #11160
Change-Id: Ica62571e923ad9545eb90502e6732b11875b164a
doc/build/changelog/unreleased_20/11160.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/mariadb.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/testing/fixtures/sql.py
setup.cfg
test/sql/test_insert_exec.py