.. 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
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
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
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)
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
# 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
# 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
# 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
# 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
only_if,\
only_on,\
fails_on_everything_except,\
+ fails_on,\
fails_if,\
succeeds_if,\
SpecPredicate,\
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'),
])
"""
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):
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