]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
further qualify pyodbc setinputsizes types for long stirngs
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Oct 2022 13:44:37 +0000 (09:44 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Oct 2022 18:11:11 +0000 (14:11 -0400)
commitf4214975a7deb5e13f8b6cf21e39697821396a7f
treef4c3f6480812e12f8d833aed892b195349b18fed
parent665c94cc2f0340735515c4f4477e11b556d2bcd8
further qualify pyodbc setinputsizes types for long stirngs

Fixed regression caused by SQL Server pyodbc change :ticket:`8177` where we
now use ``setinputsizes()`` by default; for VARCHAR, this fails if the
character size is greater than 4000 (or 2000, depending on data) characters
as the incoming datatype is NVARCHAR, which has a limit of 4000 characters,
despite the fact that VARCHAR can handle unlimited characters. Additional
pyodbc-specific typing information is now passed to ``setinputsizes()``
when the datatype's size is > 2000 characters. The change is also applied
to the :class:`.JSON` type which was also impacted by this issue for large
JSON serializations.

Fixes: #8661
Change-Id: I07fa873e95dbd2c94f3d286e93e8b3229c3a9807
doc/build/changelog/unreleased_20/8661.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/pyodbc.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/suite/test_types.py
test/dialect/mssql/test_types.py