]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
use integer division on maxlen
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jun 2025 21:33:14 +0000 (17:33 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jun 2025 21:33:14 +0000 (17:33 -0400)
this was coming out as a float and breaking alembic column
compare

Change-Id: I50160cfdb2f2933331d3c316c9985f24fb914242

lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/testing/suite/test_reflection.py

index a71042a3f02a1c2267a334e1e7bd35277c25a875..c0bf43304af4fa94ff9cb9fded0a67d2d9f293a3 100644 (file)
@@ -3738,7 +3738,7 @@ where
                 MSNChar,
                 MSNText,
             ):
-                kwargs["length"] = maxlen / 2 if maxlen != -1 else None
+                kwargs["length"] = maxlen // 2 if maxlen != -1 else None
                 if collation:
                     kwargs["collation"] = collation
 
index efb2ad505c6c1dd7439d29455a5e251defe1f39b..aa1a4e90a8419395de8612321aeab085e25c59dd 100644 (file)
@@ -2871,6 +2871,7 @@ class ComponentReflectionTestExtra(ComparesIndexes, fixtures.TestBase):
             assert isinstance(typ, sql_types.String)
 
         eq_(typ.length, 52)
+        assert isinstance(typ.length, int)
 
     @testing.requires.table_reflection
     def test_nullable_reflection(self, connection, metadata):