Commits

Anonymous committed b35b269

- Fixed MSSQL reflection bug which did not properly handle
reflection of unknown types. [ticket:1946]

  • Participants
  • Parent commits 59812b8

Comments (0)

Files changed (3)

      'echo', 'echo_pool', 'force' for 'convert_unicode',
      boolean values for 'use_native_unicode'.  
      [ticket:1899]
+
+- mssql
+   - Fixed reflection bug which did not properly handle
+     reflection of unknown types.  [ticket:1946]
      
 - informix
    - *Major* cleanup / modernization of the Informix 

lib/sqlalchemy/dialects/mssql/base.py

                     "Did not recognize type '%s' of column '%s'" % 
                     (type, name))
                 coltype = sqltypes.NULLTYPE
+            else:
+                if issubclass(coltype, sqltypes.Numeric) and \
+                        coltype is not MSReal:
+                    kwargs['scale'] = numericscale
+                    kwargs['precision'] = numericprec
 
-            if issubclass(coltype, sqltypes.Numeric) and \
-                    coltype is not MSReal:
-                kwargs['scale'] = numericscale
-                kwargs['precision'] = numericprec
-
-            coltype = coltype(**kwargs)
+                coltype = coltype(**kwargs)
             cdict = {
                 'name' : name,
                 'type' : coltype,

test/dialect/test_mssql.py

             assert sequence.increment == 3
         finally:
             table.drop()
-
-
+    
+    @testing.emits_warning("Did not recognize")
+    def test_skip_types(self):
+        meta = MetaData(testing.db)
+        testing.db.execute("""
+            create table foo (id integer primary key, data xml)
+        """)
+        try:
+            t1 = Table('foo', meta, autoload=True)
+            assert isinstance(t1.c.id.type, Integer)
+            assert isinstance(t1.c.data.type, types.NullType)
+        finally:
+            testing.db.execute("drop table foo")
+        
+        
 class QueryUnicodeTest(TestBase):
 
     __only_on__ = 'mssql'