- changed title to mysqlconnector dialect does not support ?use_unicode=0, non-unicode mode overall
- edited description
mysqlconnector dialect does not support ?use_unicode=0, non-unicode mode overall
apparently we ignore "?use_unicode=0" entirely with mysqlconnector because it's not in the create_connect_args. So turning it on, plenty breaks, b.c. mysqlconnector can't get it straight if they want to return "bytes" or "bytearray", the latter of which is a mystifying choice.
#!
python3 -m pytest test/dialect/mysql/test_dialect.py --db mysqlconnector -k test_special_encodings
================================================ test session starts ================================================
platform darwin -- Python 3.4.2 -- py-1.4.26 -- pytest-2.5.2 -- /usr/local/bin/python3
collected 11 items
test/dialect/mysql/test_dialect.py:89: DialectTest_mysql_mysqlconnector.test_special_encodings FAILED
===================================================== FAILURES ======================================================
______________________________ DialectTest_mysql_mysqlconnector.test_special_encodings ______________________________
Traceback (most recent call last):
File "<string>", line 2, in test_special_encodings
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/testing/exclusions.py", line 95, in decorate
return self._do(config._current, fn, *args, **kw)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/testing/exclusions.py", line 124, in _do
self._expect_failure(config, ex, name=fn.__name__)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/testing/exclusions.py", line 136, in _expect_failure
util.raise_from_cause(ex)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/util/compat.py", line 188, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=exc_value)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/util/compat.py", line 182, in reraise
raise value
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/testing/exclusions.py", line 122, in _do
return_value = fn(*args, **kw)
File "/Users/classic/dev/sqlalchemy/test/dialect/mysql/test_dialect.py", line 96, in test_special_encodings
conn = eng.connect()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2005, in connect
return self._connection_cls(self, **kwargs)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 72, in __init__
if connection is not None else engine.raw_connection()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2091, in raw_connection
self.pool.unique_connection, _connection)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2061, in _wrap_pool_connect
return fn()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 279, in unique_connection
return _ConnectionFairy._checkout(self)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 644, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 439, in checkout
rec = pool._do_get()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 964, in _do_get
self._dec_overflow()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/util/compat.py", line 182, in reraise
raise value
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 961, in _do_get
return self._create_connection()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 284, in _create_connection
return _ConnectionRecord(self)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 415, in __init__
exec_once(self.connection, self)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/event/attr.py", line 248, in exec_once
self(*args, **kw)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/event/attr.py", line 258, in __call__
fn(*args, **kw)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/util/langhelpers.py", line 1319, in go
return once_fn(*arg, **kw)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/strategies.py", line 157, in first_connect
dialect.initialize(c)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/mysql/base.py", line 2578, in initialize
self._detect_ansiquotes(connection)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/mysql/base.py", line 2857, in _detect_ansiquotes
self._server_ansiquotes = 'ANSI_QUOTES' in mode
TypeError: Type str doesn't support the buffer API
============================================== short test summary info ==============================================
FAIL test/dialect/mysql/test_dialect.py::DialectTest_mysql_mysqlconnector::()::test_special_encodings
================================= 10 tests deselected by '-ktest_special_encodings' =================================
====================================== 1 failed, 10 deselected in 0.04
Comments (4)
-
reporter -
reporter this is a total crapshow, requires changes in the C exts to work and I think we're better off not supporting this, this is basically mysqlconnector "raw" mode and I seem to recall this came up before. Branch at 1447abc5347bee5b8611bebe1a is some of the work involved.
-
The MySQL/Connector team is now aware of this problem. It is still unknown if this will be handled as a bug or as a feature.
It seems that changing database collation to something other than *_bin can convince the connector to not produce bytearrays. I have since given up on MySQL/Connector, I can't confirm this.
-
reporter - changed status to resolved
the docs have been updated most recently in ddab2d2351fc7 to recommend not using the "use_unicode" flag at all in Py3K.
- Log in to comment