From: Mike Bayer Date: Wed, 14 Oct 2020 16:05:40 +0000 (-0400) Subject: Add SQL Server 01000 disconnect X-Git-Tag: rel_1_4_0b1~29^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01633d94a526eb304729ed95dfbf6780c30dd258;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add SQL Server 01000 disconnect Fixes: #5646 Change-Id: I25fcba7cf866871f1232b586e7e604162bd8cc43 --- diff --git a/doc/build/changelog/unreleased_13/5646.rst b/doc/build/changelog/unreleased_13/5646.rst new file mode 100644 index 0000000000..a2ae68b4bd --- /dev/null +++ b/doc/build/changelog/unreleased_13/5646.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: bug, mssql + :tickets: 5646 + + Added SQL Server code "01000" to the list of disconnect codes. + diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index 8bc318ea03..dac6098c49 100644 --- a/lib/sqlalchemy/dialects/mssql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py @@ -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