]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add SQL Server 01000 disconnect
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Oct 2020 16:05:40 +0000 (12:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Oct 2020 17:14:42 +0000 (13:14 -0400)
Fixes: #5646
Change-Id: I25fcba7cf866871f1232b586e7e604162bd8cc43

doc/build/changelog/unreleased_13/5646.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/pyodbc.py

diff --git a/doc/build/changelog/unreleased_13/5646.rst b/doc/build/changelog/unreleased_13/5646.rst
new file mode 100644 (file)
index 0000000..a2ae68b
--- /dev/null
@@ -0,0 +1,6 @@
+.. change::
+    :tags: bug, mssql
+    :tickets: 5646
+
+    Added SQL Server code "01000" to the list of disconnect codes.
+
index 8bc318ea03aeb34851c1f448f4e3664c1c85c64d..dac6098c49c94cbcb4ebb6d524b255120da3ecc9 100644 (file)
@@ -52,7 +52,7 @@ name must be URL encoded which means using plus signs for spaces::
 
 Other keywords interpreted by the Pyodbc dialect to be passed to
 ``pyodbc.connect()`` in both the DSN and hostname cases include:
-``odbc_autotranslate``, ``ansi``, ``unicode_results``, ``autocommit``, 
+``odbc_autotranslate``, ``ansi``, ``unicode_results``, ``autocommit``,
 ``authentication`` (e.g., ``authentication=ActiveDirectoryIntegrated``).
 Note that in order for the dialect to recognize these keywords
 (including the ``driver`` keyword above) they must be all lowercase.
@@ -451,8 +451,9 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
     def is_disconnect(self, e, connection, cursor):
         if isinstance(e, self.dbapi.Error):
             code = e.args[0]
-            if code in (
+            if code in {
                 "08S01",
+                "01000",
                 "01002",
                 "08003",
                 "08007",
@@ -461,7 +462,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
                 "HYT00",
                 "HY010",
                 "10054",
-            ):
+            }:
                 return True
         return super(MSDialect_pyodbc, self).is_disconnect(
             e, connection, cursor