Login failures raised during connect are raised as RuntimeError instead of a mssql_python exception (see https://github.com/microsoft/mssql-python/wiki/Exception):
Traceback (most recent call last):
File "mssql_connect.py", line 5, in <module>
connection = connect(
^^^^^^^^^^^^^^
File ".\site-packages\mssql_python\db_connection.py", line 46, in connect
conn = Connection(
^^^^^^^^^^^
File ".\site-packages\mssql_python\connection.py", line 319, in __init__
self._conn = ddbc_bindings.Connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Login failed for user ''.
I would expect an appropriate mssql_python error to be raised.
The specific use case we have is that we use access tokens to connect to SQL Server. These tokens expire after a certain period of time after which a retry mechanism retries the operation. A mssql_python specific error such as OperationalError would help to better isolate the exceptions that have to be retried.
Login failures raised during
connectare raised asRuntimeErrorinstead of a mssql_python exception (see https://github.com/microsoft/mssql-python/wiki/Exception):I would expect an appropriate mssql_python error to be raised.
The specific use case we have is that we use access tokens to connect to SQL Server. These tokens expire after a certain period of time after which a retry mechanism retries the operation. A mssql_python specific error such as
OperationalErrorwould help to better isolate the exceptions that have to be retried.