Alex Grönholm committed a24f714

Fixed _IntegerType, _StringType etc. being rendered on MySQL

Comments (0)

Files changed (4)

 * Fixed TypeError when inflect could not determine the singular name of a table for a many-to-1 relationship
+* Fixed _IntegerType, _StringType etc. being rendered instead of proper types on MySQL


-version = '1.1.1.pre1'
+version = '1.1.1'


             for supercls in cls.__mro__:
                 if hasattr(supercls, '__visit_name__'):
                     cls = supercls
-                if supercls.__name__ != supercls.__name__.upper():
+                if supercls.__name__ != supercls.__name__.upper() and not supercls.__name__.startswith('_'):
             column.type = column.type.adapt(cls)


 from sqlalchemy.types import INTEGER, SMALLINT, VARCHAR, NUMERIC
 from sqlalchemy.dialects.postgresql.base import BIGINT, DOUBLE_PRECISION, BOOLEAN, ENUM
 from sqlalchemy.dialects.mysql.base import TINYINT
+from sqlalchemy.dialects.mysql import base as mysql
 from sqlacodegen.codegen import CodeGenerator
+    def test_mysql_column_types(self):
+        Table(
+            'simple_items', self.metadata,
+            Column('id', mysql.INTEGER),
+            Column('name', mysql.VARCHAR(255))
+        )
+        eq_(self.generate_code(), """\
+# coding: utf-8
+from sqlalchemy import Column, Integer, MetaData, String, Table
+metadata = MetaData()
+t_simple_items = Table(
+    'simple_items', metadata,
+    Column('id', Integer),
+    Column('name', String(255))
     def test_constraints_table(self):
             'simple_items', self.metadata,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.