diff options
author | Gord Thompson <gord@gordthompson.com> | 2021-02-24 08:51:55 -0700 |
---|---|---|
committer | Gord Thompson <gord@gordthompson.com> | 2021-02-24 08:51:55 -0700 |
commit | 2cd55d842f41d3f9f7b5dcf03c9c4a5e0a6be709 (patch) | |
tree | 665fd99d350e9b9953fada18dc4c98d5a2d4d0fe /lib/sqlalchemy/dialects/mssql/pyodbc.py | |
parent | 930e1a89373ff3ee8c35b6696ed6d70502f03566 (diff) | |
download | sqlalchemy-2cd55d842f41d3f9f7b5dcf03c9c4a5e0a6be709.tar.gz |
mssql+pyodbc specify ampersand separator
Specify that ampersand (not semicolon) must be used to separate
additional keyword arguments in hostname connections.
Change-Id: Id5b3276e6da8d42f5384e3cc4f5272f6e20aa61c
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/pyodbc.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/pyodbc.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index c94b50678..4c1e9e116 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |