Skip to content

mysqlclient / pymysql removal of SET NAMES seems to break MySQL 8.0 #4804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zzzeek opened this issue Aug 11, 2019 · 2 comments
Closed

mysqlclient / pymysql removal of SET NAMES seems to break MySQL 8.0 #4804

zzzeek opened this issue Aug 11, 2019 · 2 comments
Labels
bug Something isn't working external driver issues the issue involves a misbehavior on the part of the DBAPI itself, probably not SQLAlchemy mysql
Milestone

Comments

@zzzeek
Copy link
Member

zzzeek commented Aug 11, 2019

see PyMySQL/mysqlclient#383. We probably have to call SET NAMES ourselves.

@zzzeek zzzeek added bug Something isn't working external driver issues the issue involves a misbehavior on the part of the DBAPI itself, probably not SQLAlchemy mysql labels Aug 11, 2019
@zzzeek zzzeek added this to the 1.3.xx milestone Aug 11, 2019
@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the master branch:

Emit SET NAMES for all MySQL connections w charset https://gerrit.sqlalchemy.org/1407

@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the rel_1_3 branch:

Emit SET NAMES for all MySQL connections w charset https://gerrit.sqlalchemy.org/1408

sqlalchemy-bot pushed a commit that referenced this issue Aug 12, 2019
The MySQL dialects will emit "SET NAMES" at the start of a connection when
charset is given to the MySQL driver, to appease an apparent behavior
observed in MySQL 8.0 that raises a collation error when a UNION includes
string columns unioned against columns of the form CAST(NULL AS CHAR(..)),
which is what SQLAlchemy's polymorphic_union function does.   The issue
seems to have affected PyMySQL for at least a year, however has recently
appeared as of mysqlclient 1.4.4 based on changes in how this DBAPI creates
a connection.  As the presence of this directive impacts three separate
MySQL charset settings which each have intricate effects based on their
presense,  SQLAlchemy will now emit the directive on new connections to
ensure correct behavior.

Fixes: #4804
Change-Id: If9d7ee00d0ccaf773972b564fe455e8e9edf6627
(cherry picked from commit f5e57f7)
@zzzeek zzzeek modified the milestones: 1.3.xx, 1.3.x Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external driver issues the issue involves a misbehavior on the part of the DBAPI itself, probably not SQLAlchemy mysql
Projects
None yet
Development

No branches or pull requests

2 participants