summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES10
-rw-r--r--lib/sqlalchemy/dialects/mysql/mysqldb.py4
-rw-r--r--lib/sqlalchemy/test/engines.py5
3 files changed, 18 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 83ed69118..082ec8382 100644
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,16 @@ CHANGES
naming/typing information about the entities
the Query will return. Can be helpful for
building GUIs on top of ORM queries.
+
+- mysql
+
+ - The _extract_error_code() method now works
+ correctly with the "mysqldb" dialect. Previously,
+ the reconnect logic would fail for OperationalError
+ conditions, however since MySQLdb has its
+ own reconnect feature, there was no symptom
+ here unless one watched the logs.
+ [ticket:1848]
0.6.2
=====
diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py
index 6e6bb0ecc..d43b62ce3 100644
--- a/lib/sqlalchemy/dialects/mysql/mysqldb.py
+++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py
@@ -157,8 +157,10 @@ class MySQLDialect_mysqldb(MySQLDialect):
def _extract_error_code(self, exception):
try:
- return exception.orig.args[0]
+ return exception.args[0]
except AttributeError:
+ # this AttributeError is likely unnecessary,
+ # but would need to confirm against MySQLdb code
return None
def _detect_charset(self, connection):
diff --git a/lib/sqlalchemy/test/engines.py b/lib/sqlalchemy/test/engines.py
index 0cfd58d20..9e77f38d7 100644
--- a/lib/sqlalchemy/test/engines.py
+++ b/lib/sqlalchemy/test/engines.py
@@ -105,6 +105,11 @@ class ReconnectFixture(object):
return conn
def shutdown(self):
+ # TODO: this doesn't cover all cases
+ # as nicely as we'd like, namely MySQLdb.
+ # would need to implement R. Brewer's
+ # proxy server idea to get better
+ # coverage.
for c in list(self.connections):
c.close()
self.connections = []