I've a MySQL database running on an EC2 instance and Superset running in a docker container.
Pythonpath has been set, SQLAlchemy URI defined in superset_config.py file as well.
superset db upgrade and superset init command run successfully.
However, superset load_examples throws a UnicodeEncodeError error after loading a few examples, during the Loading [Unicode test data] step, and only two dashboards are visible on the UI.
Expected results
superset load_examples command runs successfully with no errors and example dashboards loaded on the UI
Actual results (error log below)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-2: character maps to
Screenshots
If applicable, add screenshots to help explain your problem.
How to reproduce the bug
- Create a MySQL database for superset. i've set charset to utf8 and collate to utf8_bin on this DB.
- Run superset within a docker container, (mysqlclient installed via requirements.txt file), define the SQLAlchemy URI in the superset_config.py file.
- Login to the superset container and run superset db upgrade, init and load_examples commands.
- See error
Environment
(please complete the following information):
- superset version:
0.36
- python version:
3.6.9
- mysqlclient:
1.4.6
- SQLAlchemy:
1.3.12
- SQLAlchemy-Utils:
0.36.1
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
- [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
Creating table [birth_names] reference
Creating some slices
Creating a dashboard
Loading [Unicode test data]
Traceback (most recent call last):
File "/usr/local/bin/superset", line 7, in
exec(compile(f.read(), file, 'exec'))
File "/app/superset/bin/superset", line 21, in
superset()
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/app/superset/cli.py", line 148, in load_examples
load_examples_run(load_test_data, only_metadata, force)
File "/app/superset/cli.py", line 97, in load_examples_run
examples.load_unicode_test_data(only_metadata, force)
File "/app/superset/examples/unicode_test_data.py", line 65, in load_unicode_test_data
index=False,
File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 2712, in to_sql
method=method,
File "/usr/local/lib/python3.6/site-packages/pandas/io/sql.py", line 518, in to_sql
method=method,
File "/usr/local/lib/python3.6/site-packages/pandas/io/sql.py", line 1320, in to_sql
table.insert(chunksize, method=method)
File "/usr/local/lib/python3.6/site-packages/pandas/io/sql.py", line 756, in insert
exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.6/site-packages/pandas/io/sql.py", line 670, in _execute_insert
conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 982, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement
distilled_params,
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context
e, statement, parameters, cursor, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1478, in _handle_dbapi_exception
util.reraise(*exc_info)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1226, in _execute_context
cursor, statement, parameters, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 148, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.6/site-packages/MySQLdb/cursors.py", line 237, in executemany
self._get_db().encoding)
File "/usr/local/lib/python3.6/site-packages/MySQLdb/cursors.py", line 253, in _do_execute_many
v = values % escape(next(args), conn)
File "/usr/local/lib/python3.6/site-packages/MySQLdb/cursors.py", line 113, in _escape_args
ret = tuple(literal(ensure_bytes(arg)) for arg in args)
File "/usr/local/lib/python3.6/site-packages/MySQLdb/cursors.py", line 113, in
ret = tuple(literal(ensure_bytes(arg)) for arg in args)
File "/usr/local/lib/python3.6/site-packages/MySQLdb/cursors.py", line 105, in ensure_bytes
return x.encode(encoding)
File "/usr/local/lib/python3.6/encodings/cp1252.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-2: character maps to