Bootstrap

python superset 中的SQL Editor 出现乱码错误怎么办

在superset里加载数据后,点击【Run Query】,会出现运行错误,如下
在这里插入图片描述
复制到notepad++里分析

<html> <body> <h1>Sorry, something went wrong</h1> <h3>500 - Internal Server Error</h3> <hr> <h2>Stacktrace</h2> <hr> <code> <pre> Traceback (most recent call last): 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\sqlalchemy\engine\base.py&#34;, line 1193, in _execute_context context) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\sqlalchemy\engine\default.py&#34;, line 507, in do_execute cursor.execute(statement, parameters) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\cursors.py&#34;, line 148, in execute result = self._query(query) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\cursors.py&#34;, line 310, in _query conn.query(q) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\connections.py&#34;, line 548, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\connections.py&#34;, line 775, in _read_query_result result.read() 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\connections.py&#34;, line 1156, in read first_packet = self.connection._read_packet() 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\connections.py&#34;, line 725, in _read_packet packet.raise_for_error() 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\protocol.py&#34;, line 221, in raise_for_error err.raise_mysql_exception(self._data) 

File &#34;D:\soft\anaconda\envs\superset\lib\site-packages\pymysql\err.py&#34;, line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.ProgrammingError: (1064, &#34;You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#39;rows, error_message, results_key, start_time, start_running_time, end_time, end_&#39; at line 1&#34;) 


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

在网上反复寻找,在经过自己分析,应该是pymysql的版本无法和mysql适应,后发现mysql太高(我的是8.0版本),可以使用5.6或5.7版本。

卸载MySQL8.0,重新安装MySQL 5.6,重新安装mysql-workbench-community-8.0.23-winx64.msi,重新安装superset后,加载数据后,成功显示数据。

;