由于 Apache Superset 中的 JSON 解码错误,无法加载仪表板列表
Unable to load dashboards list due to JSON decode error in Apache Superset
我正在尝试在我的 Superset 中获取仪表板,但遇到以下错误:
ERROR:root:Expecting ',' delimiter: line 1 column 106 (char 105)
上面的错误是在我跟踪 pod 时出现的。
在前端,我只看到:An error occurred while fetching dashboards.
完整的堆栈跟踪是:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 84, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 154, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 1567, in get_list
return self.get_list_headless(**kwargs)
File "/usr/local/lib/python3.6/site-packages/superset/views/base_api.py", line 232, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/usr/local/lib/python3.6/site-packages/superset/utils/core.py", line 1296, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 1469, in get_list_headless
_response[API_RESULT_RES_KEY] = _list_model_schema.dump(lst, many=True)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 557, in dump
result = self._serialize(processed_obj, many=many)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 517, in _serialize
for d in typing.cast(typing.Iterable[_T], obj)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 517, in <listcomp>
for d in typing.cast(typing.Iterable[_T], obj)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 521, in _serialize
value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
File "/usr/local/lib/python3.6/site-packages/marshmallow/fields.py", line 308, in serialize
value = self.get_value(obj, attr, accessor=accessor)
File "/usr/local/lib/python3.6/site-packages/marshmallow/fields.py", line 227, in get_value
return accessor_func(obj, check_key, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 478, in get_attribute
return get_value(obj, attr, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/utils.py", line 232, in get_value
return _get_value_for_key(obj, key, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/utils.py", line 246, in _get_value_for_key
return getattr(obj, key, default)
File "/usr/local/lib/python3.6/site-packages/superset/models/dashboard.py", line 158, in url
json_metadata = json.loads(self.json_metadata)
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 106 (char 105)
我试图查看我的数据库中的 dashboards
table,但没有发现任何异常情况。
我尝试加载仪表板页面 (/dashboard/list/) 并得到与上面相同的 JSON 错误。
在我的数据库中,我尝试将所有仪表板标记为 published
列下的 false
,即使错误也没有消失。
仪表板 table 中的 1 行或所有行中的 json_metadata 列似乎已损坏。我会尝试弄清它失败的原因(看起来是 this line)。您可以尝试 运行 针对数据库的开发版本的超集,并在失败的地方添加一些日志记录。您还可以尝试检查 table 中的 json_metadata 列(尝试将其提供给 python json 解析器)并查看是否可以识别导致 json.loads 函数失败。
我正在尝试在我的 Superset 中获取仪表板,但遇到以下错误:
ERROR:root:Expecting ',' delimiter: line 1 column 106 (char 105)
上面的错误是在我跟踪 pod 时出现的。
在前端,我只看到:An error occurred while fetching dashboards.
完整的堆栈跟踪是:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 84, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 154, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 1567, in get_list
return self.get_list_headless(**kwargs)
File "/usr/local/lib/python3.6/site-packages/superset/views/base_api.py", line 232, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/usr/local/lib/python3.6/site-packages/superset/utils/core.py", line 1296, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 1469, in get_list_headless
_response[API_RESULT_RES_KEY] = _list_model_schema.dump(lst, many=True)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 557, in dump
result = self._serialize(processed_obj, many=many)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 517, in _serialize
for d in typing.cast(typing.Iterable[_T], obj)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 517, in <listcomp>
for d in typing.cast(typing.Iterable[_T], obj)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 521, in _serialize
value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
File "/usr/local/lib/python3.6/site-packages/marshmallow/fields.py", line 308, in serialize
value = self.get_value(obj, attr, accessor=accessor)
File "/usr/local/lib/python3.6/site-packages/marshmallow/fields.py", line 227, in get_value
return accessor_func(obj, check_key, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/schema.py", line 478, in get_attribute
return get_value(obj, attr, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/utils.py", line 232, in get_value
return _get_value_for_key(obj, key, default)
File "/usr/local/lib/python3.6/site-packages/marshmallow/utils.py", line 246, in _get_value_for_key
return getattr(obj, key, default)
File "/usr/local/lib/python3.6/site-packages/superset/models/dashboard.py", line 158, in url
json_metadata = json.loads(self.json_metadata)
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 106 (char 105)
我试图查看我的数据库中的 dashboards
table,但没有发现任何异常情况。
我尝试加载仪表板页面 (/dashboard/list/) 并得到与上面相同的 JSON 错误。
在我的数据库中,我尝试将所有仪表板标记为 published
列下的 false
,即使错误也没有消失。
仪表板 table 中的 1 行或所有行中的 json_metadata 列似乎已损坏。我会尝试弄清它失败的原因(看起来是 this line)。您可以尝试 运行 针对数据库的开发版本的超集,并在失败的地方添加一些日志记录。您还可以尝试检查 table 中的 json_metadata 列(尝试将其提供给 python json 解析器)并查看是否可以识别导致 json.loads 函数失败。