archer icon indicating copy to clipboard operation
archer copied to clipboard

在线查询数据time类型转换错误

Open jdj199222 opened this issue 7 years ago • 1 comments

在线查询数据功能,如果查询select * from table 时候报如下错误.

精确定位后发现,是字段数据类型为time时候就会报错. 日志显示入下 [2018-07-31 11:36:51,927][MainThread:140477748217600][task_id:default][exception_logging_middleware.py:10] [ERROR]- Traceback (most recent call l ast): File "/data/archer/sql/extend_json_encoder.py", line 52, in default return convert(obj) File "/data/venv4archer/lib/python3.6/functools.py", line 803, in wrapper return dispatch(args[0].class)(*args, **kw) File "/data/archer/sql/extend_json_encoder.py", line 26, in convert raise TypeError('can not convert type') TypeError: can not convert type

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/venv4archer/lib/python3.6/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/data/venv4archer/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) File "/data/archer/sql/query.py", line 724, in query return HttpResponse(json.dumps(finalResult, cls=ExtendJSONEncoder, bigint_as_string=True), File "/data/venv4archer/lib/python3.6/site-packages/simplejson/init.py", line 399, in dumps **kw).encode(obj) File "/data/venv4archer/lib/python3.6/site-packages/simplejson/encoder.py", line 286, in encode chunks = self.iterencode(o, _one_shot=True) File "/data/venv4archer/lib/python3.6/site-packages/simplejson/encoder.py", line 368, in iterencode return _iterencode(o, 0) File "/data/archer/sql/extend_json_encoder.py", line 54, in default return super(ExtendJSONEncoder, self).default(obj) File "/data/venv4archer/lib/python3.6/site-packages/simplejson/encoder.py", line 263, in default o.class.name) TypeError: Object of type timedelta is not JSON serializable

jdj199222 avatar Jul 31 '18 06:07 jdj199222

https://github.com/jly8866/archer/pull/89 pr最后一次提交内容可解决这个问题。

hhyo avatar Jul 31 '18 13:07 hhyo