]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add InternalError for mysqlclient disconnect
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2017 16:31:38 +0000 (12:31 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2017 16:31:38 +0000 (12:31 -0400)
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
doc/build/changelog/unreleased_10/4065.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py

diff --git a/doc/build/changelog/unreleased_10/4065.rst b/doc/build/changelog/unreleased_10/4065.rst
new file mode 100644 (file)
index 0000000..375ce8c
--- /dev/null
@@ -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.
index 5b01b2c1ffca8175cff37c0501a1bd7b4fb33946..976ff367b4fb8f462ae9b619e806273ce337d0cb 100644 (file)
@@ -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)