]> 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:30:42 +0000 (15:30 -0400)
commit325f71701a8a994c982c781f59bf34f42add88e7
treebf496c9c9a00d0b96a4c7f26e360294205a9eef7
parent7cc0cead13e825796f80e7101d3837d585d46c5f
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
doc/build/changelog/unreleased_20/13451.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
test/dialect/mssql/test_reflection.py