Commits

Ben Trofatter  committed ec842fa

Added workaround for pymysql3 double wrapping ProgrammingErrors to pymysql dialect.
Added workaround for pymysql3 return a bytes object when queried for isolation level.

  • Participants
  • Parent commits 2a940e4

Comments (0)

Files changed (3)

File lib/sqlalchemy/dialects/mysql/base.py

         cursor.execute('SELECT @@tx_isolation')
         val = cursor.fetchone()[0]
         cursor.close()
+        # Py3K
+        #if isinstance(val, bytes):
+        #    val = val.decode()
+        # Py2K
+        # end Py2K
         return val.upper().replace("-", " ")
 
     def do_commit(self, dbapi_connection):

File lib/sqlalchemy/dialects/mysql/pymysql.py

     driver = 'pymysql'
 
     description_encoding = None
+    # Py3K
+    #supports_unicode_statements = True
+    # Py2K
+    # end Py2K
 
     @classmethod
     def dbapi(cls):
         return __import__('pymysql')
 
+    # Py3K
+    #def _extract_error_code(self, exception):
+    #    if isinstance(exception.args[0], Exception):
+    #        exception = exception.args[0]
+    #    return exception.args[0]
+    # Py2K
+    # end Py2K
+
 dialect = MySQLDialect_pymysql

File test/sql/test_types.py

                 # end Py2K
             )
 
+        elif testing.against('mysql+pymysql'):
+            eq_(
+                testing.db.dialect.returns_unicode_strings,
+                # Py3K
+                #True
+                # Py2K
+                False
+                # end Py2K
+            )
+
         else:
             expected = (testing.db.name, testing.db.driver) in \
                 (
                     ('mysql', 'oursql'),
                     ('mysql', 'zxjdbc'),
                     ('mysql', 'mysqlconnector'),
-                    ('mysql', 'pymysql'),
+                    #('mysql', 'pymysql'),
                     ('sqlite', 'pysqlite'),
                     ('oracle', 'zxjdbc'),
                     ('oracle', 'cx_oracle'),