From: Gord Thompson Date: Wed, 4 Dec 2019 10:47:24 +0000 (-0700) Subject: Add pass through exact pyodbc connection string. X-Git-Tag: rel_1_4_0b1~592^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5023%2Fhead;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add pass through exact pyodbc connection string. --- diff --git a/lib/sqlalchemy/dialects/mysql/pyodbc.py b/lib/sqlalchemy/dialects/mysql/pyodbc.py index c533595bbe..ff69ec3451 100644 --- a/lib/sqlalchemy/dialects/mysql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mysql/pyodbc.py @@ -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 @@ -25,7 +25,22 @@ 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