diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 10:31:21 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 10:31:21 -0400 |
| commit | 2a946254023135eddd222974cf300ffaa5583f02 (patch) | |
| tree | b8f08215e6b8f4708e57be7022b3a25980baee11 | |
| parent | ba9380ef28871b2274ab0bab75e5efddf2ced467 (diff) | |
| download | sqlalchemy-2a946254023135eddd222974cf300ffaa5583f02.tar.gz | |
Add MariaDB 1927 to is_disconnect codes
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
| -rw-r--r-- | doc/build/changelog/unreleased_13/5493.rst | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 1 | ||||
| -rw-r--r-- | test/dialect/mysql/test_dialect.py | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/doc/build/changelog/unreleased_13/5493.rst b/doc/build/changelog/unreleased_13/5493.rst new file mode 100644 index 000000000..a1f9f44b2 --- /dev/null +++ b/doc/build/changelog/unreleased_13/5493.rst @@ -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. diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 76c2039cc..90945ebad 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2533,6 +2533,7 @@ class MySQLDialect(default.DefaultDialect): e, (self.dbapi.OperationalError, self.dbapi.ProgrammingError) ): return self._extract_error_code(e) in ( + 1927, 2006, 2013, 2014, diff --git a/test/dialect/mysql/test_dialect.py b/test/dialect/mysql/test_dialect.py index cf0e0b02d..d968d994c 100644 --- a/test/dialect/mysql/test_dialect.py +++ b/test/dialect/mysql/test_dialect.py @@ -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), |
