Commits

Mike Bayer committed 27c8174

fixed possible error in mysql reflection where certain versions
return an array instead of string for SHOW CREATE TABLE call

Comments (0)

Files changed (2)

 only a given number of thread-local connections stay around (needed
 for sqlite applications that dispose of threads en masse)
 - fixed small pickle bug with lazy loaders [ticket:265]
+- fixed possible error in mysql reflection where certain versions
+return an array instead of string for SHOW CREATE TABLE call
 
 0.2.6
 - big overhaul to schema to allow truly composite primary and foreign

lib/sqlalchemy/databases/mysql.py

         CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE\n) TYPE=InnoDB
         """
         c = connection.execute("SHOW CREATE TABLE " + table.name, {})
-        desc = c.fetchone()[1].strip()
+        desc_fetched = c.fetchone()[1]
+        if type(desc_fetched) is not str:
+            # may get array.array object here, depending on version (such as mysql 4.1.14 vs. 4.1.11)
+            desc_fetched = desc_fetched.tostring()
+        desc = desc_fetched.strip()
+
         tabletype = ''
         lastparen = re.search(r'\)[^\)]*\Z', desc)
         if lastparen: