]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Updated mysqlconnector dialect to check for disconnect based
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Apr 2013 23:49:28 +0000 (19:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Apr 2013 23:49:28 +0000 (19:49 -0400)
on the apparent string message sent in the exception; tested
against mysqlconnector 1.0.9.

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
test/engine/test_reconnect.py

index 3fda776f2c5204d13f553df23a5489e97dadd9ce..ed953989110455db27c7e24bae8399ccb9b4880b 100644 (file)
@@ -3,6 +3,16 @@
 0.8 Changelog
 ==============
 
+.. changelog::
+    :version: 0.8.2
+
+    .. change::
+      :tags: bug, mysql
+
+      Updated mysqlconnector dialect to check for disconnect based
+      on the apparent string message sent in the exception; tested
+      against mysqlconnector 1.0.9.
+
 .. changelog::
     :version: 0.8.1
     :released: April 27, 2013
index 0a1a6b91e968181428b00b1e3c4e694bbd60296e..b1906d3b98311576b3d5d5d6c854210e78218588 100644 (file)
@@ -113,7 +113,8 @@ class MySQLDialect_mysqlconnector(MySQLDialect):
         errnos = (2006, 2013, 2014, 2045, 2055, 2048)
         exceptions = (self.dbapi.OperationalError, self.dbapi.InterfaceError)
         if isinstance(e, exceptions):
-            return e.errno in errnos
+            return e.errno in errnos or \
+                "MySQL Connection not available." in str(e)
         else:
             return False
 
index 9aecb81a99729942a6b2de9a9650f35685dab706..b176c05ea1f06d91ba86919e50850daf97e5cb60 100644 (file)
@@ -617,19 +617,12 @@ class InvalidateDuringResultTest(fixtures.TestBase):
         meta.drop_all()
         engine.dispose()
 
-    @testing.fails_on('+cymysql',
-                      "Buffers the result set and doesn't check for "
-                      "connection close")
-    @testing.fails_on('+pymysql',
-                      "Buffers the result set and doesn't check for "
-                      "connection close")
-    @testing.fails_on('+mysqldb',
-                      "Buffers the result set and doesn't check for "
-                      "connection close")
-    @testing.fails_on('+pg8000',
-                      "Buffers the result set and doesn't check for "
-                      "connection close")
-    @testing.fails_on('+informixdb',
+    @testing.fails_if([
+                    '+mysqlconnector', '+mysqldb'
+                    '+cymysql', '+pymysql', '+pg8000'
+                    ], "Buffers the result set and doesn't check for "
+                        "connection close")
+    @testing.fails_if('+informixdb',
                       "Wrong error thrown, fix in informixdb?")
     def test_invalidate_on_results(self):
         conn = engine.connect()