superset icon indicating copy to clipboard operation
superset copied to clipboard

Error of metric name use Chinese Text

Open toop opened this issue 9 years ago • 7 comments

Superset version

Windows 10 x64,python 3.6.1 superset 0.18.5

Expected results

metric name can use The Chinese Text

Actual results

stacktrace:null status:"failed" error:"'utf-8' codec can't decode byte 0xbb in position 0: invalid start byte" webui message:'utf-8' codec can't decode byte 0xbb in position 0: invalid start byte

Steps to reproduce

I writed Chinese text for sql Metric name in the Sqla Table Edit‘s List Sqla Metric,when run the query,it's error:'utf-8' codec can't decode byte 0xbb in position 0: invalid start byte, Request URL:http://127.0.0.1:8000/superset/explore_json/table/8/?form_data=%7B%22datasource%22%3A%228__table%22%2C%22viz_type%22%3A%22big_number_total%22%2C%22slice_id%22%3A37%2C%22granularity_sqla%22%3A%22vip15%22%2C%22time_grain_sqla%22%3A%22day%22%2C%22since%22%3A%221+year+ago%22%2C%22until%22%3A%22now%22%2C%22metric%22%3A%22%E7%A7%AF%E5%88%86%E4%BD%99%E9%A2%9D%E6%B1%87%E6%80%BB%22%2C%22y_axis_format%22%3A%22.3s%22%2C%22where%22%3A%22%22%2C%22having%22%3A%22%22%2C%22filters%22%3A%5B%5D%7D Request Method:GET Status Code:400 BAD REQUEST Remote Address:127.0.0.1:8000

form_data:{"datasource":"8__table","viz_type":"big_number_total","slice_id":37,"granularity_sqla":"vip15","time_grain_sqla":"day","since":"1 year ago","until":"now","metric":"积分余额汇总","y_axis_format":".3s","where":"","having":"","filters":[]}

query: "SELECT "积分余额汇总"↵FROM↵ (SELECT sum(vipxx.vip10) AS "积分余额汇总"↵ FROM vipxx↵ WHERE vip15 >= TO_TIMESTAMP('2016-07-16T10:01:14', 'YYYY-MM-DD"T"HH24:MI:SS.ff6')↵ AND vip15 <= TO_TIMESTAMP('2017-07-16T10:01:14', 'YYYY-MM-DD"T"HH24:MI:SS.ff6'))↵WHERE ROWNUM <= 50000"

How to fix the error,Help me please,Thk!

toop avatar Jul 16 '17 02:07 toop

Please post the full stacktrace found in superset server logs, am pretty sure we already the same issue reported though.

xrmx avatar Jul 17 '17 07:07 xrmx

Almost the same question. I need chinese legends on my plot. So I took chinese as my metric name. WebUI shows "'ascii' codec can't encode characters in position 160-161: ordinal not in range(128)". I have set the charset on db

  1. SQLAlchemy URI mysql+pymysql://XXX?charset=utf8 2.engine_params { "metadata_params": {}, "engine_params": {"connect_args": { "charset": "utf8" }} }

Traceback (most recent call last): File "/home/ad/anaconda2/lib/python2.7/site-packages/superset/viz.py", line 238, in get_payload df = self.get_df() File "/home/ad/anaconda2/lib/python2.7/site-packages/superset/viz.py", line 78, in get_df self.results = self.datasource.query(query_obj) File "/home/ad/anaconda2/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 552, in query sql = self.get_query_str(query_obj) File "/home/ad/anaconda2/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 326, in get_query_str compile_kwargs={"literal_binds": True} UnicodeEncodeError: 'ascii' codec can't encode characters in position 160-161: ordinal not in range(128)

stjacob avatar Jul 18 '17 03:07 stjacob

I have the same problem,and addressed by #3136

luciuschina avatar Jul 25 '17 11:07 luciuschina

@luciuschina #3136 is this very same bug :)

xrmx avatar Jul 25 '17 12:07 xrmx

@xrmx sorry,https://github.com/apache/incubator-superset/issues/2554

luciuschina avatar Jul 27 '17 04:07 luciuschina

Notice: this issue has been closed because it has been inactive for 270 days. Feel free to comment and request for this issue to be reopened.

mistercrunch avatar Apr 23 '18 05:04 mistercrunch

Is this problem resolved? I ran into the same problem with Korean text as a dimension name

keeyong avatar Jul 18 '18 04:07 keeyong