diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-05 12:59:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-05 18:24:59 -0400 |
| commit | 7fb7365622ee751b264bbbd4e7394ef8e81d45c5 (patch) | |
| tree | 4d094f22847406e47cf2191b96c8057ec8ee5418 /doc/build/core | |
| parent | e79ab08165e01dc7af50fcffadb31468ace51b6c (diff) | |
| download | sqlalchemy-7fb7365622ee751b264bbbd4e7394ef8e81d45c5.tar.gz | |
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
Diffstat (limited to 'doc/build/core')
| -rw-r--r-- | doc/build/core/connections.rst | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/doc/build/core/connections.rst b/doc/build/core/connections.rst index 80156b418..726b5a501 100644 --- a/doc/build/core/connections.rst +++ b/doc/build/core/connections.rst @@ -1854,7 +1854,9 @@ as follows: * SQLite - supported for SQLite versions 3.35 and above * PostgreSQL - all supported Postgresql versions (9 and above) -* SQL Server - all supported SQL Server versions +* SQL Server - **disabled by default as of SQLAlchemy 2.0.9** - the SQL syntax + used has been shown to not be safe for RETURNING + (see https://github.com/sqlalchemy/sqlalchemy/issues/9603) * MariaDB - supported for MariaDB versions 10.5 and above * MySQL - no support, no RETURNING feature is present * Oracle - supports RETURNING with executemany using native cx_Oracle / OracleDB @@ -1887,11 +1889,7 @@ The feature can also be disabled from being used implicitly for a particular ) The reason one might want to disable RETURNING for a specific table is to -work around backend-specific limitations. For example, there is a known -limitation of SQL Server that the ``OUTPUT inserted.<colname>`` feature -may not work correctly for a table that has INSERT triggers established; -such a table may need to include ``implicit_returning=False`` (see -:ref:`mssql_triggers`). +work around backend-specific limitations. .. _engine_insertmanyvalues_page_size: @@ -1929,9 +1927,8 @@ varies by dialect and server version; the largest size is 32700 (chosen as a healthy distance away from PostgreSQL's limit of 32767 and SQLite's modern limit of 32766, while leaving room for additional parameters in the statement as well as for DBAPI quirkiness). Older versions of SQLite (prior to 3.32.0) -will set this value to 999; SQL Server sets it to 2099. MariaDB has no -established limit however 32700 remains as a limiting factor for SQL message -size. +will set this value to 999. MariaDB has no established limit however 32700 +remains as a limiting factor for SQL message size. The value of the "batch size" can be affected :class:`_engine.Engine` wide via the :paramref:`_sa.create_engine.insertmanyvalues_page_size` parameter. |
