]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add pass through exact pyodbc connection string. 5023/head
authorGord Thompson <gord@gordthompson.com>
Wed, 4 Dec 2019 10:47:24 +0000 (03:47 -0700)
committerGord Thompson <gord@gordthompson.com>
Wed, 4 Dec 2019 10:47:24 +0000 (03:47 -0700)
lib/sqlalchemy/dialects/mysql/pyodbc.py

index c533595bbe8090a47caa69762ef0d5560a568f61..ff69ec3451932f2904a65ebccea4903a9bf9820f 100644 (file)
@@ -5,7 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-"""
+r"""
 
 
 .. dialect:: mysql+pyodbc
     MySQL Connector/ODBC and specify the "ANSI" (**not** "Unicode")
     version of the driver in your DSN or connection string.
 
-"""
+Pass through exact pyodbc connection string::
+
+    import urllib
+    connection_string = (
+        'DRIVER=MySQL ODBC 8.0 ANSI Driver;'
+        'SERVER=localhost;'
+        'PORT=3307;'
+        'DATABASE=mydb;'
+        'UID=root;'
+        'PWD=(whatever);'
+        'charset=utf8mb4;'
+    )
+    params = urllib.parse.quote_plus(connection_string)
+    connection_uri = "mysql+pyodbc:///?odbc_connect=%s" % params
+
+"""  # noqa
 
 import re
 import sys