Issue 1:
Migrated issue, originally created by Anonymous

Our application has a hierarchy containing items for sale: BaseItem, Item, PackItem. BaseItem is the common base class. Item is a 'normal' item, and PackItem is a collection of items sold as one.

There is also a class called Collection. A Collection may contain many items, and an item may belong to many collections.

Modeling this in SQLAlchemy causes the following runtime error:

Traceback (most recent call last):

File "C:\tmp\testcase.py", line 100, in ?

i = Item()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

mapper.py", line 646, in init

mapper = mapper.compile()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

mapper.py", line 321, in compile

self._compile_all()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

mapper.py", line 341, in _compile_all

mapper._initialize_properties()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

mapper.py", line 596, in _initialize_properties

prop.init(key, self)

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

interfaces.py", line 60, in init

self.do_init()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

properties.py", line 186, in do_init

self._create_polymorphic_joins()

File "c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg\sqlalchemy\orm

properties.py", line 382, in _create_polymorphic_joins

raise exceptions.AssertionError(str(self) + ": Could not find corresponding

column for " + str(c) + " in selectable " + str(self.mapper.select_table))

sqlalchemy.exceptions.AssertionError: Collection.items (BaseItem): Could not fin

d corresponding column for base_item_collection.collection_id in selectable SELE

CT item.dummy, base_item.child_name, item.id

FROM base_item JOIN item ON base_item.id = item.id UNION ALL SELECT CAST(NULL AS

INTEGER) AS dummy, anon_d86.child_name, anon_d86.id

FROM (SELECT base_item.id AS id, base_item.child_name AS child_name

FROM base_item

WHERE base_item.child_name = ?) AS anon_d86

It appears that SQLAlchemy assumes the target class of the many-to-many relationship contains the same fields as the join table.

The following is a potential fix for your evaluation. It is a slightly modified version of the _determine_remote_side function in sqlalchemy.orm.properties.PropertyLoader. For many-to-many relationships, it does not add the join table's foreign keys to the remote_side collection. This change appears to work in our brief initial testing.

def _determine_remote_side(self):

if len(self.remote_side):

return

self.remote_side = util.Set()

if self.direction is sync.MANYTOONE:
for c in self._opposite_side:
self.remote_side.add(c)
elif self.direction is sync.ONETOMANY:
for c in self.foreign_keys:
self.remote_side.add(c)
elif self.direction is sync.MANYTOMANY:
# The target table for a MANYTOMANY join does
# not contain the foreign key fields of the join table itself.
pass

Issue 2:
Migrated issue, originally created by Thomas Tanner (@ttanner)

sqlalchemy HEAD, mysql 5.5.38, pymysql 0.6.6,

mysql=mysql+pysql://user:password@localhost/test_schema

running

py.test --db mysql --dropfirst --backend-only --log-info=sqlalchemy.orm.mapper --log-debug=sqlalchemy.pool --log-info=sqlalchemy.engine

platform darwin -- Python 3.4.3 -- py-1.4.26 -- pytest-2.7.0 --

DEBUG:sqlalchemy.pool.QueuePool:Created new connection <pymysql.connections.Connection object at 0x10800cf60>
INFO:sqlalchemy.engine.base.Engine:SHOW VARIABLES LIKE 'sql_mode'
INFO:sqlalchemy.engine.base.Engine:()
INFO:sqlalchemy.engine.base.Engine:SELECT DATABASE()
INFO:sqlalchemy.engine.base.Engine:()
INFO:sqlalchemy.engine.base.Engine:show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'
INFO:sqlalchemy.engine.base.Engine:()
INFO:sqlalchemy.engine.base.Engine:SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1
INFO:sqlalchemy.engine.base.Engine:()
INFO:sqlalchemy.engine.base.Engine:SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1
INFO:sqlalchemy.engine.base.Engine:()
INFO:sqlalchemy.engine.base.Engine:SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin AS anon_1
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW FULL TABLES FROM `test_schema`
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW FULL TABLES FROM `test_schema`
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Created new connection <pymysql.connections.Connection object at 0x108031c18>
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW FULL TABLES FROM `test_schema`
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW FULL TABLES FROM `test_schema`
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> rollback-on-return
============================= test session starts ==============================
platform darwin -- Python 3.4.3 -- py-1.4.26 -- pytest-2.7.0 --

collecting ... DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SELECT CURRENT_TIMESTAMP AS current_timestamp_1
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW VARIABLES LIKE 'lower_case_table_names'
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW VARIABLES LIKE 'lower_case_table_names'
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW VARIABLES LIKE 'lower_case_table_names'
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x108031c18> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> checked out from pool
INFO:sqlalchemy.engine.base.Engine:SHOW VARIABLES LIKE 'lower_case_table_names'
INFO:sqlalchemy.engine.base.Engine:()
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <pymysql.connections.Connection object at 0x10800cf60> rollback-on-return
collected 1846 items

test/aaa_profiling/test_compiler.py::CompileTest_mysql_pymysql::test_insert PASSED
test/aaa_profiling/test_compiler.py::CompileTest_mysql_pymysql::test_select PASSED
test/aaa_profiling/test_compiler.py::CompileTest_mysql_pymysql::test_select_labels PASSED
test/aaa_profiling/test_compiler.py::CompileTest_mysql_pymysql::test_update PASSED
test/aaa_profiling/test_compiler.py::CompileTest_mysql_pymysql::test_update_whereclause PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_DecimalResultProcessor_init PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_DecimalResultProcessor_process PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_UnicodeResultProcessor_init PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_ad_hoc_types PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_alias_pathing PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_fixture PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_join_cache PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_key_fallback_result PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_many_discarded_relationships PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_many_updates PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_mapper_reset PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_orm_many_engines PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_path_registry PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_session PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_sessionmaker PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_type_compile PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_unicode_warnings PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_warnings_util PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_with_inheritance PASSED
test/aaa_profiling/test_memusage.py::MemUsageTest_mysql_pymysql::test_with_manytomany PASSED
test/aaa_profiling/test_resultset.py::ExecutionTest_mysql_pymysql::test_minimal_connection_execute FAILEDINFO:sqlalchemy.pool.QueuePool:Pool disposed. Pool size: 5 Connections in pool: 0 Current Overflow: -5 Current Checked out connections: 0
INFO:sqlalchemy.pool.QueuePool:Pool recreating
Encountered a stray connection in test cleanup: {<sqlalchemy.pool._ConnectionRecord object at 0x10ad34f28>}
Traceback (most recent call last):
File "bin/py.test", line 9, in <module>
load_entry_point('pytest==2.7.0', 'console_scripts', 'py.test')()
File "$site/_pytest/config.py", line 41, in main
return config.hook.pytest_cmdline_main(config=config)
File "$site/_pytest/core.py", line 521, in __call__
return self._docall(self.methods, kwargs)
File "$site/_pytest/core.py", line 528, in _docall
firstresult=self.firstresult).execute()
File "$site/_pytest/core.py", line 394, in execute
res = method(*args)
File "$site/_pytest/main.py", line 116, in pytest_cmdline_main
return wrap_session(config, _main)
File "$site/_pytest/main.py", line 109, in wrap_session
exitstatus=session.exitstatus)
File "$site/_pytest/core.py", line 521, in __call__
return self._docall(self.methods, kwargs)
File "$site/_pytest/core.py", line 528, in _docall
firstresult=self.firstresult).execute()
File "$site/_pytest/core.py", line 393, in execute
return wrapped_call(method(*args), self.execute)
File "$site/_pytest/core.py", line 109, in wrapped_call
wrap_controller.send(call_outcome)
File "$site/_pytest/terminal.py", line 356, in pytest_sessionfinish
outcome.get_result()
File "$site/_pytest/core.py", line 137, in get_result
raise ex[1].with_traceback(ex[2])
File "$site/_pytest/core.py", line 123, in __init__
self.result = func()
File "$site/_pytest/core.py", line 394, in execute
res = method(*args)
File "$site/_pytest/runner.py", line 55, in pytest_sessionfinish
session._setupstate.teardown_all()
File "$site/_pytest/runner.py", line 375, in teardown_all
self._pop_and_teardown()
File "$site/_pytest/runner.py", line 348, in _pop_and_teardown
self._teardown_with_finalization(colitem)
File "$site/_pytest/runner.py", line 366, in _teardown_with_finalization
self._callfinalizers(colitem)
File "$site/_pytest/runner.py", line 363, in _callfinalizers
py.builtin._reraise(*exc)
File "$site/py/_builtin.py", line 227, in _reraise
raise cls.with_traceback(val, tb)
File "$site/_pytest/runner.py", line 356, in _callfinalizers
fin()
File "$path/test/../lib/sqlalchemy/testing/plugin/pytestplugin.py", line 149, in finalize
class_teardown(item.parent.parent)
File "$path/test/../lib/sqlalchemy/testing/plugin/pytestplugin.py", line 178, in class_teardown
plugin_base.stop_test_class(item.cls)
File "$path/test/../lib/sqlalchemy/testing/plugin/plugin_base.py", line 426, in stop_test_class
assertions.global_cleanup_assertions()
File "$path/test/../lib/sqlalchemy/testing/assertions.py", line 165, in global_cleanup_assertions
_assert_no_stray_pool_connections()
File "$path/test/../lib/sqlalchemy/testing/assertions.py", line 203, in _assert_no_stray_pool_connections
"after gc.collect(): %s" % err
AssertionError: Stray connection refused to leave after gc.collect(): {<sqlalchemy.pool._ConnectionRecord object at 0x10ad34f28>}

without logging and with duplicate errors removed (table users exists):

==================================== ERRORS ====================================
ERROR at setup of ComponentReflectionTest_mysql_pymysql.test_autoincrement_col
Traceback (most recent call last):
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/default.py", line 442, in do_execute
cursor.execute(statement, parameters)
File "$site/pymysql/cursors.py", line 134, in execute
result = self._query(query)
File "$site/pymysql/cursors.py", line 282, in _query
conn.query(q)
File "$site/pymysql/connections.py", line 768, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "$site/pymysql/connections.py", line 929, in _read_query_result
result.read()
File "$site/pymysql/connections.py", line 1125, in read
first_packet = self.connection._read_packet()
File "$site/pymysql/connections.py", line 893, in _read_packet
packet.check_error()
File "$site/pymysql/connections.py", line 369, in check_error
err.raise_mysql_exception(self._data)
File "$site/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "$site/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
pymysql.err.InternalError: (1050, "Table 'users' already exists")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "$path/test/../lib/sqlalchemy/testing/fixtures.py", line 83, in setup_class
cls._setup_once_tables()
File "$path/test/../lib/sqlalchemy/testing/fixtures.py", line 112, in _setup_once_tables
cls.metadata.create_all(cls.bind)
File "$path/test/../lib/sqlalchemy/sql/schema.py", line 3611, in create_all
tables=tables)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1843, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1471, in _run_visitor
**kwargs).traverse_single(element)
File "$path/test/../lib/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 727, in visit_metadata
_is_metadata_operation=True)
File "$path/test/../lib/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 761, in visit_table
include_foreign_key_constraints=include_foreign_key_constraints
File "$path/test/../lib/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1332, in _handle_dbapi_exception
exc_info
File "$path/test/../lib/sqlalchemy/util/compat.py", line 188, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=exc_value)
File "$path/test/../lib/sqlalchemy/util/compat.py", line 181, in reraise
raise value.with_traceback(tb)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/default.py", line 442, in do_execute
cursor.execute(statement, parameters)
File "$site/pymysql/cursors.py", line 134, in execute
result = self._query(query)
File "$site/pymysql/cursors.py", line 282, in _query
conn.query(q)
File "$site/pymysql/connections.py", line 768, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "$site/pymysql/connections.py", line 929, in _read_query_result
result.read()
File "$site/pymysql/connections.py", line 1125, in read
first_packet = self.connection._read_packet()
File "$site/pymysql/connections.py", line 893, in _read_packet
packet.check_error()
File "$site/pymysql/connections.py", line 369, in check_error
err.raise_mysql_exception(self._data)
File "$site/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "$site/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1050, "Table 'users' already exists") [SQL: '\nCREATE TABLE test_schema.users (\n\tuser_id INTEGER NOT NULL AUTO_INCREMENT, \n\ttest1 CHAR(5) NOT NULL, \n\ttest2 FLOAT(5) NOT NULL, \n\tparent_user_id INTEGER, \n\tPRIMARY KEY (user_id), \n\tFOREIGN KEY(parent_user_id) REFERENCES test_schema.users (user_id)\n)ENGINE=InnoDB\n\n']

...
=================================== FAILURES ===================================
_________________ EnumSetTest_mysql_pymysql.test_unicode_enum __________________
Traceback (most recent call last):
File "<string>", line 2, in test_unicode_enum
File "$path/test/../lib/sqlalchemy/testing/util.py", line 195, in provide_metadata
return fn(*args, **kw)
File "$path/test/dialect/mysql/test_types.py", line 914, in test_unicode_enum
metadata.create_all()
File "$path/test/../lib/sqlalchemy/sql/schema.py", line 3611, in create_all
tables=tables)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1843, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1471, in _run_visitor
**kwargs).traverse_single(element)
File "$path/test/../lib/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 727, in visit_metadata
_is_metadata_operation=True)
File "$path/test/../lib/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 761, in visit_table
include_foreign_key_constraints=include_foreign_key_constraints
File "$path/test/../lib/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1335, in _handle_dbapi_exception
util.reraise(*exc_info)
File "$path/test/../lib/sqlalchemy/util/compat.py", line 182, in reraise
raise value
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/default.py", line 442, in do_execute
cursor.execute(statement, parameters)
File "$site/pymysql/cursors.py", line 134, in execute
result = self._query(query)
File "$site/pymysql/cursors.py", line 282, in _query
conn.query(q)
File "$site/pymysql/connections.py", line 766, in query
sql = sql.encode(self.encoding, 'surrogateescape')
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 95: ordinal not in range(256)
_______________ EnumSetTest_mysql_pymysql.test_unicode_roundtrip _______________
Traceback (most recent call last):
File "<string>", line 2, in test_unicode_roundtrip
File "$path/test/../lib/sqlalchemy/testing/util.py", line 195, in provide_metadata
return fn(*args, **kw)
File "$path/test/dialect/mysql/test_types.py", line 830, in test_unicode_roundtrip
set_table.create()
File "$path/test/../lib/sqlalchemy/sql/schema.py", line 725, in create
checkfirst=checkfirst)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1843, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1471, in _run_visitor
**kwargs).traverse_single(element)
File "$path/test/../lib/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 761, in visit_table
include_foreign_key_constraints=include_foreign_key_constraints
File "$path/test/../lib/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1335, in _handle_dbapi_exception
util.reraise(*exc_info)
File "$path/test/../lib/sqlalchemy/util/compat.py", line 182, in reraise
raise value
File "$path/test/../lib/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "$path/test/../lib/sqlalchemy/engine/default.py", line 442, in do_execute
cursor.execute(statement, parameters)
File "$site/pymysql/cursors.py", line 134, in execute
result = self._query(query)
File "$site/pymysql/cursors.py", line 282, in _query
conn.query(q)
File "$site/pymysql/connections.py", line 766, in query
sql = sql.encode(self.encoding, 'surrogateescape')
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 87: ordinal not in range(256)
=========================== short test summary info ============================
FAIL test/dialect/mysql/test_types.py::EnumSetTest_mysql_pymysql::()::test_unicode_enum
FAIL test/dialect/mysql/test_types.py::EnumSetTest_mysql_pymysql::()::test_unicode_roundtrip
!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 25 failures !!!!!!!!!!!!!!!!!!!!
========= 2 failed, 95 passed, 334 skipped, 23 error in 62.13 seconds ==========