]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
mssql doc updates
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Oct 2022 05:49:03 +0000 (01:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Oct 2022 05:51:19 +0000 (01:51 -0400)
clarify some URL things

Change-Id: Ic162834052f06fd3a6c010ce5d091903fdc65cd8
(cherry picked from commit c262184ae5bac969b18eff8e10ba6d94c229499d)

lib/sqlalchemy/dialects/mssql/pyodbc.py

index edb76f26525e8bcc272298e57f7851bfd4040f07..053b7ac5482aaf6c40fa5cbfd056dfcd0c910f8e 100644 (file)
@@ -49,18 +49,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"
     )
 
@@ -71,11 +71,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",
         },
     )