diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-27 19:18:06 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-27 19:18:06 -0400 |
commit | 50576a01eb39742632268fe1e595a554625171eb (patch) | |
tree | dfdc8410792c9b20786349f77026fbb8f7e6b500 | |
parent | 460139f630a8db71f2a12eae0b95c75c858210f8 (diff) | |
download | sqlalchemy-50576a01eb39742632268fe1e595a554625171eb.tar.gz |
- 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().
- other mysql-connector fixes; latest version seems to do better on
function call counts
-rw-r--r-- | doc/build/changelog/changelog_09.rst | 11 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/mysqlconnector.py | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 7 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 2 | ||||
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | test/profiles.txt | 8 | ||||
-rw-r--r-- | test/requirements.py | 18 |
7 files changed, 38 insertions, 14 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst index de24d35aa..f16dd4f89 100644 --- a/doc/build/changelog/changelog_09.rst +++ b/doc/build/changelog/changelog_09.rst @@ -15,6 +15,17 @@ :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 Added some new event mechanics for dialect-level events; the initial diff --git a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py index 408bc41dd..3536c3ad8 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py +++ b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py @@ -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 diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 7b2d0f40a..76e48f8c8 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -367,6 +367,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 datetime.datetime() objects with historic (pre 1970) values.""" diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index 7e2ef8ab8..5d8005f4b 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -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) @@ -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 diff --git a/test/profiles.txt b/test/profiles.txt index de5b65e84..439c2abf5 100644 --- a/test/profiles.txt +++ b/test/profiles.txt @@ -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 diff --git a/test/requirements.py b/test/requirements.py index d04c1a0aa..4184058b2 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -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): @@ -499,6 +494,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 datetime.datetime() objects with historic (pre 1900) values.""" |