mysqlclient added internalerror for the interfaceerror issue

Issue #4065 resolved
Mike Bayer repo owner created an issue

https://github.com/PyMySQL/mysqlclient-python/issues/202

means we need this for reconnect tests to pass:

diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index 5b01b2c1f..e8cfcbae4 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -1785,7 +1785,7 @@ class MySQLDialect(default.DefaultDialect):
                           self.dbapi.ProgrammingError)):
             return self._extract_error_code(e) in \
                 (2006, 2013, 2014, 2045, 2055)
-        elif isinstance(e, self.dbapi.InterfaceError):
+        elif isinstance(e, (self.dbapi.InterfaceError, self.dbapi.InternalError)):
             # if underlying connection is closed,
             # this is the error you get
             return "(0, '')" in str(e)

might as well backport to 1.0.

Comments (4)

  1. Mike Bayer reporter

    Add InternalError for mysqlclient disconnect

    mysqlclient as of 1.3.11 changed the exception class for a particular disconnect situation from InterfaceError to InternalError; the disconnection detection logic now accommodates this.

    Change-Id: I294f90f794491fd363548719222d8e3008480615 Fixes: #4065

    → <<cset 65680b2343ef>>

  2. Mike Bayer reporter

    Add InternalError for mysqlclient disconnect

    mysqlclient as of 1.3.11 changed the exception class for a particular disconnect situation from InterfaceError to InternalError; the disconnection detection logic now accommodates this.

    Change-Id: I294f90f794491fd363548719222d8e3008480615 Fixes: #4065 (cherry picked from commit 65680b2343ef421a62582e23e2b35293732933ad)

    → <<cset 4be865f79bea>>

  3. Mike Bayer reporter

    Add InternalError for mysqlclient disconnect

    mysqlclient as of 1.3.11 changed the exception class for a particular disconnect situation from InterfaceError to InternalError; the disconnection detection logic now accommodates this.

    Change-Id: I294f90f794491fd363548719222d8e3008480615 Fixes: #4065 (cherry picked from commit 65680b2343ef421a62582e23e2b35293732933ad)

    → <<cset a550232fc26f>>

  4. Log in to comment