From: Gord Thompson Date: Wed, 24 Feb 2021 15:51:55 +0000 (-0700) Subject: mssql+pyodbc specify ampersand separator X-Git-Tag: rel_1_4_0~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cd55d842f41d3f9f7b5dcf03c9c4a5e0a6be709;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git mssql+pyodbc specify ampersand separator Specify that ampersand (not semicolon) must be used to separate additional keyword arguments in hostname connections. Change-Id: Id5b3276e6da8d42f5384e3cc4f5272f6e20aa61c --- diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index c94b506788..4c1e9e1160 100644 --- a/lib/sqlalchemy/dialects/mssql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py @@ -53,9 +53,18 @@ 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``, -``authentication`` (e.g., ``authentication=ActiveDirectoryIntegrated``). +``authentication``. Note that in order for the dialect to recognize these keywords (including the ``driver`` keyword above) they must be all lowercase. +Multiple additional keyword arguments must be separated by an +ampersand (``&``), not a semicolon: + + engine = create_engine( + "mssql+pyodbc://scott:tiger@myhost:port/databasename" + "?driver=ODBC+Driver+17+for+SQL+Server" + "&authentication=ActiveDirectoryIntegrated" + ) + Pass through exact Pyodbc string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^