Commits

Mike Bayer committed d08bb32

- test explicitly for 'VIEW', 'SYSTEM VIEW'
- move the test to the reflection tests

  • Participants
  • Parent commits 4f1acfb

Comments (0)

Files changed (3)

     name that's a reserved word.  Courtesy Jeff
     Dairiki. [ticket:2460]
 
+  - [bug] Fixed bug whereby get_view_names() for
+    "information_schema" schema would fail
+    to retrieve views marked as "SYSTEM VIEW".
+    courtesy Matthew Turland.
+
 0.7.6
 =====
 - orm

File lib/sqlalchemy/dialects/mysql/base.py

         rp = connection.execute("SHOW FULL TABLES FROM %s" %
                 self.identifier_preparer.quote_identifier(schema))
         return [row[0] for row in self._compat_fetchall(rp, charset=charset)\
-                                                    if 'VIEW' in row[1]]
+                                                    if row[1] in ('VIEW', 'SYSTEM VIEW')]
 
     @reflection.cache
     def get_table_options(self, connection, table_name, schema=None, **kw):

File test/dialect/test_mysql.py

             }
         )
 
-    @testing.only_on(['mysql'], 'requires information_schema')
-    @testing.exclude('mysql', '<', (5, 0, 0), 'no information_schema support')
-    def test_system_views(self):
-        dialect = testing.db.dialect
-        connection = testing.db.connect()
-        view_names = dialect.get_view_names(connection, "information_schema")
-        self.assert_('TABLES' in view_names)
 
 class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
     "Test MySQL column types"
         finally:
             meta.drop_all()
 
+    @testing.exclude('mysql', '<', (5, 0, 0), 'no information_schema support')
+    def test_system_views(self):
+        dialect = testing.db.dialect
+        connection = testing.db.connect()
+        view_names = dialect.get_view_names(connection, "information_schema")
+        self.assert_('TABLES' in view_names)
 
 
 class SQLTest(fixtures.TestBase, AssertsCompiledSQL):