summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-13 18:57:05 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-13 18:57:05 +0000
commit799f45866789271301d5b09a175c789d1e4f6e95 (patch)
tree6ff2a0cc0a09a19797acdeccc6b6b491dfa00e82 /lib/sqlalchemy/databases/mysql.py
parent05eb3073df25c1add9657b503230ea500514e351 (diff)
downloadsqlalchemy-799f45866789271301d5b09a175c789d1e4f6e95.tar.gz
adjusted mysql autoload from a named schema, esp. for windows
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 6f8b83189..01d3fa6bc 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -1540,9 +1540,11 @@ class MySQLDialect(ansisql.ANSIDialect):
charset = self._detect_charset(connection)
casing = self._detect_casing(connection, charset)
- if casing == 1:
+ # is this really needed?
+ if casing == 1 and table.name != table.name.lower():
table.name = table.name.lower()
- table.metadata.tables[table.name]= table
+ lc_alias = schema._get_table_key(table.name, table.schema)
+ table.metadata.tables[lc_alias] = table
sql = self._show_create_table(connection, table, charset)
@@ -2022,12 +2024,9 @@ class MySQLSchemaReflector(object):
"columns." % (', '.join(loc_names)))
continue
- if ref_name in table.metadata.tables:
- ref_table = table.metadata.tables[ref_name]
- if ref_table.schema and ref_table.schema != ref_schema:
- warnings.warn(RuntimeWarning(
- "Table %s.%s is shadowing %s.%s in this MetaData" %
- (ref_table.schema, ref_name, table.schema, table.name)))
+ ref_key = schema._get_table_key(ref_name, ref_schema)
+ if ref_key in table.metadata.tables:
+ ref_table = table.metadata.tables[ref_key]
else:
ref_table = schema.Table(ref_name, table.metadata,
schema=ref_schema,