]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add MariaDB 1927 to is_disconnect codes
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Aug 2020 14:31:21 +0000 (10:31 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 5 Aug 2020 14:35:25 +0000 (10:35 -0400)
Added MariaDB code 1927 to the list of "disconnect" codes, as recent
MariaDB versions apparently use this code when the database server was
stopped.

Fixes: #5493
Change-Id: I63f1d692f36cb0411ead278556e3f8c64ab72ea4
(cherry picked from commit 2a946254023135eddd222974cf300ffaa5583f02)

doc/build/changelog/unreleased_13/5493.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_dialect.py

diff --git a/doc/build/changelog/unreleased_13/5493.rst b/doc/build/changelog/unreleased_13/5493.rst
new file mode 100644 (file)
index 0000000..a1f9f44
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, mysql
+    :tickets: 5493
+
+    Added MariaDB code 1927 to the list of "disconnect" codes, as recent
+    MariaDB versions apparently use this code when the database server was
+    stopped.
index 87d35587aa42817d7c24e06574cbed77737553eb..c65269324693f61530c0ed1c8669ff3a8d9ada44 100644 (file)
@@ -2508,6 +2508,7 @@ class MySQLDialect(default.DefaultDialect):
             e, (self.dbapi.OperationalError, self.dbapi.ProgrammingError)
         ):
             return self._extract_error_code(e) in (
+                1927,
                 2006,
                 2013,
                 2014,
index 2f199de84313c1aa9c32f3ac33e35b48f6f545ec..53ceefa696de2e37a5b50b73f426155b4d733051 100644 (file)
@@ -28,6 +28,8 @@ class DialectTest(fixtures.TestBase):
         (None, "cONnection was kILLEd", "InternalError", "pymysql", True),
         (None, "cONnection aLREady closed", "InternalError", "pymysql", True),
         (None, "something broke", "InternalError", "pymysql", False),
+        (1927, "Connection was killed", "OperationalError", "pymysql", True),
+        (1927, "Connection was killed", "OperationalError", "mysqldb", True),
         (2006, "foo", "OperationalError", "mysqldb", True),
         (2006, "foo", "OperationalError", "pymysql", True),
         (2007, "foo", "OperationalError", "mysqldb", False),