]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
turn off use_insertmanyvalues for SQL Server
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Apr 2023 16:59:13 +0000 (12:59 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Apr 2023 22:24:59 +0000 (18:24 -0400)
commit7fb7365622ee751b264bbbd4e7394ef8e81d45c5
tree4d094f22847406e47cf2191b96c8057ec8ee5418
parente79ab08165e01dc7af50fcffadb31468ace51b6c
turn off use_insertmanyvalues for SQL Server

we will keep trying to find workarounds, however this
patch is the "turn it off" patch

Due to a critical bug identified in SQL Server, the SQLAlchemy
"insertmanyvalues" feature which allows fast INSERT of many rows while also
supporting RETURNING unfortunately needs to be disabled for SQL Server. SQL
Server is apparently unable to guarantee that the order of rows inserted
matches the order in which they are sent back by OUTPUT inserted when
table-valued rows are used with INSERT in conjunction with OUTPUT inserted.
We are trying to see if Microsoft is able to confirm this undocumented
behavior however there is no known workaround, other than it's not safe to
use table-valued expressions with OUTPUT inserted for now.

Fixes: #9603
Change-Id: I4b932fb8774390bbdf4e870a1f6cfe9a78c4b105
doc/build/changelog/unreleased_20/9603.rst [new file with mode: 0644]
doc/build/changelog/whatsnew_20.rst
doc/build/core/connections.rst
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mssql/pyodbc.py
test/dialect/mssql/test_engine.py
test/dialect/mssql/test_query.py
test/dialect/mssql/test_types.py
test/orm/test_unitofworkv2.py