]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
disable setinputsizes only for true DBAPI executemany
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Dec 2022 21:03:58 +0000 (16:03 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Dec 2022 21:10:25 +0000 (16:10 -0500)
commite3b905be21f392b17817decff5e1e76f02ccad03
treee0ab46e472d7e9b6393326bc4f1921498c1a4978
parent990663c732e5bde43ed05eba0ade6d96fc7a2b26
disable setinputsizes only for true DBAPI executemany

Fixed regression caused by the combination of :ticket:`8177`, re-enable
setinputsizes for SQL server unless fast_executemany + DBAPI executemany is
used for a statement, along with :ticket:`6047`, implement
"insertmanyvalues", which bypasses DBAPI executemany in place of a custom
DBAPI execute for INSERT statements. setinputsizes would incorrectly not be
used for a multiple parameter-set INSERT statement that used
"insertmanyvalues" if fast_executemany were turned on, as the check would
incorrectly assume this is a DBAPI executemany call.  The "regression"
would then be that the "insertmanyvalues" statement format is apparently
slightly more sensitive to multiple rows that don't use the same types
for each row, so in such a case setinputsizes is especially needed.

The fix repairs the fast_executemany check so that it only disables
setinputsizes if true DBAPI executemany is to be used.

Fixes: #8917
Change-Id: I78895606a99848d4f92ecf38ded92dc5d6d48c6f
doc/build/changelog/unreleased_20/8917.rst [new file with mode: 0644]
lib/sqlalchemy/connectors/pyodbc.py
test/dialect/mssql/test_engine.py