]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Tweaked the settings for mysql-connector-python; in Py2K, the
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Mar 2014 23:18:06 +0000 (19:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Mar 2014 23:18:06 +0000 (19:18 -0400)
"supports unicode statements" flag is now False, so that SQLAlchemy
will encode the *SQL string* (note: *not* the parameters)
to bytes before sending to the database.  This seems to allow
all unicode-related tests to pass for mysql-connector, including those
that use non-ascii table/column names, as well as some tests for the
TEXT type using unicode under cursor.executemany().
- other mysql-connector fixes; latest version seems to do better on
function call counts

doc/build/changelog/changelog_09.rst
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_types.py
setup.cfg
test/profiles.txt
test/requirements.py

index de24d35aa01c8b45325cfb543dd8829bf9336f98..f16dd4f89ad7f2d82db18f044ffd92b803543aad 100644 (file)
 .. changelog::
     :version: 0.9.4
 
+    .. change::
+        :tags: bug, mysql
+
+        Tweaked the settings for mysql-connector-python; in Py2K, the
+        "supports unicode statements" flag is now False, so that SQLAlchemy
+        will encode the *SQL string* (note: *not* the parameters)
+        to bytes before sending to the database.  This seems to allow
+        all unicode-related tests to pass for mysql-connector, including those
+        that use non-ascii table/column names, as well as some tests for the
+        TEXT type using unicode under cursor.executemany().
+
     .. change::
         :tags: feature, engine
 
index 408bc41dd25447cc11d7427bae1b4413d70a7d37..3536c3ad81e8741c267dc8f7ec9d81d920cf9134 100644 (file)
@@ -52,8 +52,11 @@ class _myconnpyBIT(BIT):
 
 class MySQLDialect_mysqlconnector(MySQLDialect):
     driver = 'mysqlconnector'
-    supports_unicode_statements = True
+
+    if util.py2k:
+        supports_unicode_statements = False
     supports_unicode_binds = True
+
     supports_sane_rowcount = True
     supports_sane_multi_rowcount = True
 
index 7b2d0f40ae68a807ad885033494ecc8fcb0dd0ea..76e48f8c87d9cafadc7f0963d4321f0364d08776 100644 (file)
@@ -366,6 +366,13 @@ class SuiteRequirements(Requirements):
 
         return exclusions.open()
 
+    @property
+    def date_coerces_from_datetime(self):
+        """target dialect accepts a datetime object as the target
+        of a date column."""
+
+        return exclusions.open()
+
     @property
     def date_historic(self):
         """target dialect supports representation of Python
index 7e2ef8ab8b100790f3f229c815b5e3d8c62d512b..5d8005f4bdfe266a3a30c896340563a25796fb71 100644 (file)
@@ -299,7 +299,7 @@ class DateTest(_DateFixture, fixtures.TablesTest):
 
 
 class DateTimeCoercedToDateTimeTest(_DateFixture, fixtures.TablesTest):
-    __requires__ = 'date',
+    __requires__ = 'date', 'date_coerces_from_datetime'
     __backend__ = True
     datatype = Date
     data = datetime.datetime(2012, 10, 15, 12, 57, 18)
index e929c17e4b615b9ae94bb07dc6003e1aebcaec11..d00c2fffffbc8deeac6a753081a4629d21aecfb8 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -35,6 +35,7 @@ postgresql=postgresql://scott:tiger@127.0.0.1:5432/test
 postgres=postgresql://scott:tiger@127.0.0.1:5432/test
 postgresql_jython=postgresql+zxjdbc://scott:tiger@127.0.0.1:5432/test
 mysql=mysql://scott:tiger@127.0.0.1:3306/test
+mysqlconnector=mysql+mysqlconnector://scott:tiger@127.0.0.1:3306/test
 mssql=mssql+pyodbc://scott:tiger@ms_2005
 oursql=mysql+oursql://scott:tiger@127.0.0.1:3306/test
 pymysql=mysql+pymysql://scott:tiger@127.0.0.1:3306/test?charset=utf8
index de5b65e84e8f04bb9c20c0e2d6f14cb06362df13..439c2abf5900010b890f1cb879eca07580ad99d5 100644 (file)
@@ -167,7 +167,7 @@ test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove
 
 # TEST: test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline
 
-test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline 2.7_mysql_mysqlconnector_cextensions 111739
+test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline 2.7_mysql_mysqlconnector_cextensions 100535
 test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline 2.7_mysql_mysqlconnector_nocextensions 120756
 test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline 2.7_mysql_mysqldb_cextensions 30052
 test.aaa_profiling.test_orm.DeferOptionsTest.test_baseline 2.7_mysql_mysqldb_nocextensions 39069
@@ -272,7 +272,7 @@ test.aaa_profiling.test_orm.MergeBackrefsTest.test_merge_pending_with_all_pks 3.
 # TEST: test.aaa_profiling.test_orm.MergeTest.test_merge_load
 
 test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.6_sqlite_pysqlite_nocextensions 1521
-test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.7_mysql_mysqlconnector_cextensions 2453
+test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.7_mysql_mysqlconnector_cextensions 2271
 test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.7_mysql_mysqlconnector_nocextensions 2478
 test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.7_mysql_mysqldb_cextensions 1388
 test.aaa_profiling.test_orm.MergeTest.test_merge_load 2.7_mysql_mysqldb_nocextensions 1413
@@ -467,7 +467,7 @@ test.aaa_profiling.test_resultset.ResultSetTest.test_contains_doesnt_compile 3.4
 # TEST: test.aaa_profiling.test_resultset.ResultSetTest.test_string
 
 test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.6_sqlite_pysqlite_nocextensions 15447
-test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.7_mysql_mysqlconnector_cextensions 110262
+test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.7_mysql_mysqlconnector_cextensions 92960
 test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.7_mysql_mysqlconnector_nocextensions 125282
 test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.7_mysql_mysqldb_cextensions 512
 test.aaa_profiling.test_resultset.ResultSetTest.test_string 2.7_mysql_mysqldb_nocextensions 15505
@@ -494,7 +494,7 @@ test.aaa_profiling.test_resultset.ResultSetTest.test_string 3.4_sqlite_pysqlite_
 # TEST: test.aaa_profiling.test_resultset.ResultSetTest.test_unicode
 
 test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.6_sqlite_pysqlite_nocextensions 15447
-test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.7_mysql_mysqlconnector_cextensions 110262
+test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.7_mysql_mysqlconnector_cextensions 92960
 test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.7_mysql_mysqlconnector_nocextensions 125282
 test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.7_mysql_mysqldb_cextensions 512
 test.aaa_profiling.test_resultset.ResultSetTest.test_unicode 2.7_mysql_mysqldb_nocextensions 45505
index d04c1a0aa2e199f252b0bfec1323816376811c6f..4184058b2dc9a0655a538ff684c82f32bd1de88f 100644 (file)
@@ -13,6 +13,7 @@ from sqlalchemy.testing.exclusions import \
      only_if,\
      only_on,\
      fails_on_everything_except,\
+     fails_on,\
      fails_if,\
      succeeds_if,\
      SpecPredicate,\
@@ -399,11 +400,6 @@ class DefaultRequirements(SuiteRequirements):
             no_support('sybase', 'FIXME: guessing, needs confirmation'),
             no_support('mssql+pymssql', 'no FreeTDS support'),
 
-            LambdaPredicate(
-                lambda config: (not util.py3k and against(config, "mysql+mysqlconnector")),
-                "mysqlconnector seems to handle heavy unicode only in py3k"
-            ),
-
             exclude('mysql', '<', (4, 1, 1), 'no unicode connection support'),
             ])
 
@@ -437,9 +433,8 @@ class DefaultRequirements(SuiteRequirements):
 
         """
         return skip_if('mssql+pymssql', 'crashes on pymssql') + \
-                    fails_on_everything_except('mysql+mysqldb', 'mysql+oursql',
-                                       'sqlite+pysqlite', 'mysql+pymysql',
-                                       'mysql+cymysql')
+                    fails_on_everything_except('mysql',
+                                       'sqlite+pysqlite')
 
     @property
     def sane_multi_rowcount(self):
@@ -498,6 +493,13 @@ class DefaultRequirements(SuiteRequirements):
 
         return exclusions.open()
 
+    @property
+    def date_coerces_from_datetime(self):
+        """target dialect accepts a datetime object as the target
+        of a date column."""
+
+        return fails_on('mysql+mysqlconnector')
+
     @property
     def date_historic(self):
         """target dialect supports representation of Python