From: Mike Bayer Date: Fri, 27 Jun 2014 19:52:40 +0000 (-0400) Subject: - MySQL error 2014 "commands out of sync" appears to be raised as a X-Git-Tag: rel_0_8_7~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=034912c1d869bece2981ab5999b551f54b934b3d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - MySQL error 2014 "commands out of sync" appears to be raised as a ProgrammingError, not OperationalError, in modern MySQL-Python versions; all MySQL error codes that are tested for "is disconnect" are now checked within OperationalError and ProgrammingError regardless. fixes #3101 --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 5a32b21e50..45bd851acc 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -11,6 +11,16 @@ .. changelog:: :version: 0.8.7 + .. change:: + :tags: bug, mysql + :versions: 1.0.0, 0.9.5 + :tickets: 3101 + + MySQL error 2014 "commands out of sync" appears to be raised as a + ProgrammingError, not OperationalError, in modern MySQL-Python versions; + all MySQL error codes that are tested for "is disconnect" are now + checked within OperationalError and ProgrammingError regardless. + .. change:: :tags: bug, mysql :versions: 1.0.0, 0.9.5 diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index a0a97ba814..92b0c4930f 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2165,7 +2165,7 @@ class MySQLDialect(default.DefaultDialect): return [row['data'][0:row['gtrid_length']] for row in resultset] def is_disconnect(self, e, connection, cursor): - if isinstance(e, self.dbapi.OperationalError): + if isinstance(e, (self.dbapi.OperationalError, self.dbapi.ProgrammingError)): return self._extract_error_code(e) in \ (2006, 2013, 2014, 2045, 2055) elif isinstance(e, self.dbapi.InterfaceError):