diff options
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index c820474c4..38d2a9516 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -1542,9 +1542,14 @@ class MySQLDialect(default.DefaultDialect): return False def get_default_schema_name(self, connection): + try: + return connection.info['default_schema'] + except KeyError: + connection.info['default_schema'] = schema = \ + connection.execute('SELECT DATABASE()').scalar() + return schema return connection.execute('SELECT DATABASE()').scalar() - get_default_schema_name = util.cache_decorator(get_default_schema_name) - + def table_names(self, connection, schema): """Return a Unicode SHOW TABLES from a given schema.""" |