summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/pymysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-21 17:09:45 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-21 17:09:45 -0400
commit23c744b54e94a0d003a7e7236af7868cc31a1161 (patch)
treebdf0bf1708f30f34eb2db757040e00c1ecfda64f /lib/sqlalchemy/dialects/mysql/pymysql.py
parentd5af821b5d564141451f5534a0bb922508e89e70 (diff)
downloadsqlalchemy-23c744b54e94a0d003a7e7236af7868cc31a1161.tar.gz
- Improvements to the operation of the pymysql dialect on
Python 3, including some important decode/bytes steps. Issues remain with BLOB types due to driver issues. Courtesy Ben Trofatter. - start using util.py3k, we will eventually remove the sa2to3 fixer entirely
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/pymysql.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/pymysql.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/pymysql.py b/lib/sqlalchemy/dialects/mysql/pymysql.py
index 25e2dadd3..ba48017ac 100644
--- a/lib/sqlalchemy/dialects/mysql/pymysql.py
+++ b/lib/sqlalchemy/dialects/mysql/pymysql.py
@@ -22,27 +22,23 @@ the pymysql driver as well.
"""
from .mysqldb import MySQLDialect_mysqldb
-
+from ...util import py3k
class MySQLDialect_pymysql(MySQLDialect_mysqldb):
driver = 'pymysql'
description_encoding = None
- # Py3K
- #supports_unicode_statements = True
- # Py2K
- # end Py2K
+ if py3k:
+ supports_unicode_statements = True
@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
+ if py3k:
+ def _extract_error_code(self, exception):
+ if isinstance(exception.args[0], Exception):
+ exception = exception.args[0]
+ return exception.args[0]
dialect = MySQLDialect_pymysql