]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed unicode support for PyMySQL when using an "executemany"
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Mar 2015 23:05:22 +0000 (19:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Mar 2015 23:25:13 +0000 (19:25 -0400)
operation with unicode parameters.  SQLAlchemy now passes both
the statement as well as the bound parameters as unicode
objects, as PyMySQL generally uses string interpolation
internally to produce the final statement, and in the case of
executemany does the "encode" step only on the final statement.
fixes #3337

doc/build/changelog/changelog_09.rst
lib/sqlalchemy/dialects/mysql/pymysql.py
test/sql/test_types.py

index 3c38de454922664b9a6563106ce94e8797b818c9..53c4eeaaaba2ccb4b47201e1d848f4f43ab9ba38 100644 (file)
 .. changelog::
     :version: 0.9.10
 
+    .. change::
+        :tags: bug, mysql, pymysql
+        :tickets: 3337
+        :versions: 1.0.0b4
+
+        Fixed unicode support for PyMySQL when using an "executemany"
+        operation with unicode parameters.  SQLAlchemy now passes both
+        the statement as well as the bound parameters as unicode
+        objects, as PyMySQL generally uses string interpolation
+        internally to produce the final statement, and in the case of
+        executemany does the "encode" step only on the final statement.
+
     .. change::
         :tags: bug, py3k, mysql
         :tickets: 3333
index 92aaf89af8a90d9d13d6f8bc178e193522de53e0..87159b5613839487c4930db05ec17d5f17f0f075 100644 (file)
@@ -37,7 +37,12 @@ class MySQLDialect_pymysql(MySQLDialect_mysqldb):
     driver = 'pymysql'
 
     description_encoding = None
+
+    # generally, these two values should be both True
+    # or both False.   PyMySQL unicode tests pass all the way back
+    # to 0.4 either way.  See [ticket:3337]
     supports_unicode_statements = True
+    supports_unicode_binds = True
 
     @classmethod
     def dbapi(cls):
index 8b353c04915faac910e7fe8275664da9aedb3e4b..1fac13b05a63d6715ba6de8a7d20cf11f5b815e4 100644 (file)
@@ -972,6 +972,7 @@ class UnicodeTest(fixtures.TestBase):
                     ('postgresql', 'pypostgresql'),
                     ('postgresql', 'pg8000'),
                     ('postgresql', 'zxjdbc'),
+                    ('mysql', 'pymysql'),
                     ('mysql', 'oursql'),
                     ('mysql', 'zxjdbc'),
                     ('mysql', 'mysqlconnector'),