diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-01 12:31:38 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-01 12:31:38 -0400 |
commit | 65680b2343ef421a62582e23e2b35293732933ad (patch) | |
tree | d3700ac855efdb695133ba41e3cb36630e5825d8 | |
parent | 56845d8cc2678c0aefd889a7fc711150661cd8e8 (diff) | |
download | sqlalchemy-65680b2343ef421a62582e23e2b35293732933ad.tar.gz |
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
-rw-r--r-- | doc/build/changelog/unreleased_10/4065.rst | 9 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_10/4065.rst b/doc/build/changelog/unreleased_10/4065.rst new file mode 100644 index 000000000..375ce8cf1 --- /dev/null +++ b/doc/build/changelog/unreleased_10/4065.rst @@ -0,0 +1,9 @@ +.. change:: + :tags: bug, mysql + :tickets: 4065 + :versions: 1.2.0b3, 1.1.14 + + 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. diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 5b01b2c1f..976ff367b 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -1785,7 +1785,8 @@ 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) |