diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-29 19:49:28 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-29 19:49:28 -0400 |
commit | eb431e4aa5a0dbf3af73497289aade857cf70233 (patch) | |
tree | 48d6d9304b92de2e7558c12da356cb0ceb0ea455 | |
parent | 2cea98dfc511abd569adff2deba3e6d0d0760f3e (diff) | |
download | sqlalchemy-eb431e4aa5a0dbf3af73497289aade857cf70233.tar.gz |
Updated mysqlconnector dialect to check for disconnect based
on the apparent string message sent in the exception; tested
against mysqlconnector 1.0.9.
-rw-r--r-- | doc/build/changelog/changelog_08.rst | 10 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/mysqlconnector.py | 3 | ||||
-rw-r--r-- | test/engine/test_reconnect.py | 19 |
3 files changed, 18 insertions, 14 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 3fda776f2..ed9539891 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -4,6 +4,16 @@ ============== .. 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 diff --git a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py index 0a1a6b91e..b1906d3b9 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py +++ b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py @@ -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 diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index 9aecb81a9..b176c05ea 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -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() |