]> 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:10:10 +0000 (19:10 -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

(cherry picked from commit dcf5408f7d315b4d9ddec5d0d696eb364d763099)

Conflicts:
lib/sqlalchemy/dialects/mysql/pymysql.py

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 c4b953fab6e976a9760bb6c8e7de9d45f5972afa..96650f935541d0229b11ad918788b6d00a575e28 100644 (file)
@@ -31,8 +31,12 @@ class MySQLDialect_pymysql(MySQLDialect_mysqldb):
     driver = 'pymysql'
 
     description_encoding = None
-    if py3k:
-        supports_unicode_statements = True
+
+    # 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 fd7dafc84406e190593ae9f7c8e2cec64353962a..5469567a71029e74f686f6d95c4f5aafceee09cd 100644 (file)
@@ -931,6 +931,7 @@ class UnicodeTest(fixtures.TestBase):
                     ('postgresql', 'pypostgresql'),
                     ('postgresql', 'pg8000'),
                     ('postgresql', 'zxjdbc'),
+                    ('mysql', 'pymysql'),
                     ('mysql', 'oursql'),
                     ('mysql', 'zxjdbc'),
                     ('mysql', 'mysqlconnector'),