]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't apply a length to reflected TEXT / NTEXT
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 12 Aug 2026 19:30:42 +0000 (15:30 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 12 Aug 2026 19:32:35 +0000 (15:32 -0400)
commit1730a092684f272c8ba9843f89f76e80b160324f
treebf8ea28960929c54062d78652502790a82ff0174
parentfa4fd8bf266f73c7c3fd1679ac53e52b9542f32a
Don't apply a length to reflected TEXT / NTEXT

Fixed issue in SQL Server reflection where ``TEXT`` and ``NTEXT``
columns would be reflected with a spurious length of 16 and 8,
respectively.  These are unlengthed LOB datatypes; the value
originates from the ``sys.columns.max_length`` column, which reports
the size of the in-row LOB pointer rather than a character length for
these types.  The reflected ``TEXT`` and ``NTEXT`` types now have a
``length`` of ``None``, so that a reflected table emits valid DDL when
re-created, which previously failed with "Cannot specify a column
width on data type text".

Fixes: #13451
Change-Id: I8456688fc8d21fe25f326c6bf0f7b13aa1fc838c
(cherry picked from commit 325f71701a8a994c982c781f59bf34f42add88e7)
doc/build/changelog/unreleased_20/13451.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
test/dialect/mssql/test_reflection.py