diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-28 01:49:03 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-28 01:49:03 -0400 |
| commit | c262184ae5bac969b18eff8e10ba6d94c229499d (patch) | |
| tree | 50c819f61fc50fbd16de035dc30076dddf044155 /lib | |
| parent | 5db5912d6ac1c94642591ae4f53a9ebc77026e98 (diff) | |
| download | sqlalchemy-c262184ae5bac969b18eff8e10ba6d94c229499d.tar.gz | |
mssql doc updates
clarify some URL things
Change-Id: Ic162834052f06fd3a6c010ce5d091903fdc65cd8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/pyodbc.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index 09b4a80b6..3b8caef3b 100644 --- a/lib/sqlalchemy/dialects/mssql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py @@ -51,18 +51,18 @@ name must be URL encoded which means using plus signs for spaces:: engine = create_engine("mssql+pyodbc://scott:tiger@myhost:port/databasename?driver=ODBC+Driver+17+for+SQL+Server") -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``. -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:49242/databasename" - "?driver=ODBC+Driver+17+for+SQL+Server" +The ``driver`` keyword is significant to the pyodbc dialect and must be +specified in lowercase. + +Any other names passed in the query string are passed through in the pyodbc +connect string, such as ``authentication``, ``TrustServerCertificate``, etc. +Multiple keyword arguments must be separated by an ampersand (``&``); these +will be translated to semicolons when the pyodbc connect string is generated +internally:: + + e = create_engine( + "mssql+pyodbc://scott:tiger@mssql2017:1433/test?" + "driver=ODBC+Driver+18+for+SQL+Server&TrustServerCertificate=yes" "&authentication=ActiveDirectoryIntegrated" ) @@ -73,11 +73,12 @@ The equivalent URL can be constructed using :class:`_sa.engine.URL`:: "mssql+pyodbc", username="scott", password="tiger", - host="myhost", - port=49242, - database="databasename", + host="mssql2017", + port=1433, + database="test", query={ - "driver": "ODBC Driver 17 for SQL Server", + "driver": "ODBC Driver 18 for SQL Server", + "TrustServerCertificate": "yes", "authentication": "ActiveDirectoryIntegrated", }, ) |
