[Sqlalchemy-commits] sqlalchemy: Modified MySQLDialect.get_view_names() to also retur...
Brought to you by:
zzzeek
From: <co...@sq...> - 2012-04-12 16:23:56
|
details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/60b2077593f9 changeset: 8187:60b2077593f9 user: elazar <tob...@gm...> date: Wed Apr 11 21:32:00 2012 -0500 description: Modified MySQLDialect.get_view_names() to also return system views such as those in information_schema Subject: sqlalchemy: Fixed test_system_views not checking for MySQL >= 5.0.0 as information_schema support is not available in previous versions details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/ddadb227794a changeset: 8188:ddadb227794a user: elazar <tob...@gm...> date: Thu Apr 12 07:35:49 2012 -0500 description: Fixed test_system_views not checking for MySQL >= 5.0.0 as information_schema support is not available in previous versions Subject: sqlalchemy: Merged in elazar/sqlalchemy/fix/mysql-system-views (pull request #6) details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/4f1acfbd77df changeset: 8189:4f1acfbd77df user: zzzeek <cl...@zz...> date: Thu Apr 12 12:16:48 2012 -0400 description: Merged in elazar/sqlalchemy/fix/mysql-system-views (pull request #6) Subject: sqlalchemy: - test explicitly for 'VIEW', 'SYSTEM VIEW' details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/d08bb32a48c2 changeset: 8190:d08bb32a48c2 user: Mike Bayer <mi...@zz...> date: Thu Apr 12 12:21:02 2012 -0400 description: - test explicitly for 'VIEW', 'SYSTEM VIEW' - move the test to the reflection tests Subject: sqlalchemy: seems like there's a branch here..oh well details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/63e0b887ac93 changeset: 8191:63e0b887ac93 user: Mike Bayer <mi...@zz...> date: Thu Apr 12 12:22:32 2012 -0400 description: seems like there's a branch here..oh well diffstat: lib/sqlalchemy/dialects/mysql/base.py | 3 +-- test/dialect/test_mysql.py | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diffs (38 lines): diff -r 27c9bfcc4001 -r 63e0b887ac93 lib/sqlalchemy/dialects/mysql/base.py --- a/lib/sqlalchemy/dialects/mysql/base.py Wed Apr 11 13:03:52 2012 -0400 +++ b/lib/sqlalchemy/dialects/mysql/base.py Thu Apr 12 12:22:32 2012 -0400 @@ -2021,7 +2021,6 @@ @reflection.cache def get_view_names(self, connection, schema=None, **kw): - charset = self._connection_charset if self.server_version_info < (5, 0, 2): raise NotImplementedError if schema is None: @@ -2032,7 +2031,7 @@ 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 row[1] == 'VIEW'] + if 'VIEW' in row[1]] @reflection.cache def get_table_options(self, connection, table_name, schema=None, **kw): diff -r 27c9bfcc4001 -r 63e0b887ac93 test/dialect/test_mysql.py --- a/test/dialect/test_mysql.py Wed Apr 11 13:03:52 2012 -0400 +++ b/test/dialect/test_mysql.py Thu Apr 12 12:22:32 2012 -0400 @@ -108,6 +108,14 @@ } ) + @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" |