I need schema support and "it works at all" support in MySQL, so I had
to change these things. It was'n't "character_Set_results" it was
"character_set_results". The older MySQL 4? doesn't have this value at
all. Hopefully I will be fully upgraded in a few weeks.

MySQL 4.0.24:

show variables like 'char%';

| character_set  |
latin1
| character_sets | latin1 big5 cp1251 cp1257 croat czech danish dec8
dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian
koi8_ru koi8_ukr latin1_de latin2 latin5 sjis swe7 tis620 ujis usa7
win1250 win1251ukr win1251 |

The "table exists" function sucks. Is raising an error necessarily
catastrophic here?

Index: lib/sqlalchemy/databases/mysql.py
===================================================================
--- lib/sqlalchemy/databases/mysql.py   (revision 2550)
+++ lib/sqlalchemy/databases/mysql.py   (working copy)
@@ -367,7 +367,13 @@
         # i have tried dozens of approaches here with no luck.
statements like
         # DESCRIBE and SHOW CREATE TABLE work better, but they raise
an error when
         # the table does not exist.
-        cursor = connection.execute("show table status like %s",
[table_name])
+        if schema: # dwh MySQL schema hack...
+            default = connection.execute("select
database()").fetchone()[0]
+            connection.execute("USE %s" % schema)
+            cursor = connection.execute("show table status like %s",
[table_name])
+            connection.execute("USE %s" % default)
+        else:
+            cursor = connection.execute("show table status like %s",
[table_name])
         return bool( not not cursor.rowcount )

     def reflecttable(self, connection, table):
@@ -377,7 +383,7 @@
             cs = cs.tostring()
         case_sensitive = int(cs) == 0

-        decode_from = connection.execute("show variables like
'character_Set_results'").fetchone()[1]
+        decode_from = connection.execute("show variables like
'character_set_results'").fetchone()[1]

         if not case_sensitive:
             table.name = table.name.lower()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to