]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
possible fix for [ticket:276]. if mysql detects case-insensitivity, converts
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2006 00:30:36 +0000 (00:30 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2006 00:30:36 +0000 (00:30 +0000)
tables to lower case names

lib/sqlalchemy/databases/mysql.py

index 825d779e12185fb1c81acba767347b890d2766d2..bb6b41d78f8f18e4d96a9def66885ac01dbbe999 100644 (file)
@@ -317,9 +317,11 @@ class MySQLDialect(ansisql.ANSIDialect):
         return bool( not not cursor.rowcount )
 
     def reflecttable(self, connection, table):
-        # to use information_schema:
-        #ischema.reflecttable(self, table, ischema_names, use_mysql=True)
-        
+        # reference:  http://dev.mysql.com/doc/refman/5.0/en/name-case-sensitivity.html
+        case_sensitive = connection.execute("show variables like 'lower_case_table_names'").fetchone()[1] == 0
+        if not case_sensitive:
+            table.name = table.name.lower()
+            table.metadata.tables[table.name]= table
         c = connection.execute("describe " + table.name, {})
         found_table = False
         while True: