]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- test explicitly for 'VIEW', 'SYSTEM VIEW'
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 12 Apr 2012 16:21:02 +0000 (12:21 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 12 Apr 2012 16:21:02 +0000 (12:21 -0400)
- move the test to the reflection tests

CHANGES
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/test_mysql.py

diff --git a/CHANGES b/CHANGES
index 161668e82c717da8e2e52f34d0a9edba9ed4acd0..96383e1d74be6bb193a9358f7be09a5057aef7bb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -81,6 +81,11 @@ CHANGES
     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
index 7d856f0b7da77516277cafafc04631470cf7015b..780007a4d843839861356acf6e086510c1b24ca0 100644 (file)
@@ -2031,7 +2031,7 @@ class MySQLDialect(default.DefaultDialect):
         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):
index da59e7984093835468ba39455314c391a50e4e53..5a34a79a0d6278cef29e8e9585576d954bb10b3d 100644 (file)
@@ -108,13 +108,6 @@ class DialectTest(fixtures.TestBase):
             }
         )
 
-    @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"
@@ -1127,6 +1120,12 @@ class ReflectionTest(fixtures.TestBase, AssertsExecutionResults):
         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):