diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-12-18 18:01:12 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-12-18 18:01:12 -0500 |
commit | 255a6ee18b9d68b5150f1793e0a318d8ccd913bf (patch) | |
tree | f78d4e1d62c4fa0a369643acd5fe302bbd902b13 /lib/sqlalchemy | |
parent | d6d61ffe4ce207428b24b38431b75af5f5df1cf4 (diff) | |
parent | 565a56153149f0d27934abf1bc1a7fa81e59c484 (diff) | |
download | sqlalchemy-255a6ee18b9d68b5150f1793e0a318d8ccd913bf.tar.gz |
Merge remote-tracking branch 'origin/pr/5023'
Change-Id: I28884213a86ff3c8fbb5f6377114bba6503cb671
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/pyodbc.py | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/pyodbc.py b/lib/sqlalchemy/dialects/mysql/pyodbc.py index 0da5a8eaf..ff69ec345 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 @@ -14,13 +14,33 @@ :connectstring: mysql+pyodbc://<username>:<password>@<dsnname> :url: http://pypi.python.org/pypi/pyodbc/ - .. note:: The PyODBC for MySQL dialect is not well supported, and - is subject to unresolved character encoding issues - which exist within the current ODBC drivers available. - (see http://code.google.com/p/pyodbc/issues/detail?id=25). - Other dialects for MySQL are recommended. - -""" +.. note:: + + The PyODBC for MySQL dialect is **not tested as part of + SQLAlchemy's continuous integration**. + The recommended MySQL dialects are mysqlclient and PyMySQL. + However, if you want to use the mysql+pyodbc dialect and require + full support for ``utf8mb4`` characters (including supplementary + characters like emoji) be sure to use a current release of + 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 |