Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jdj199222 opened this issue Jul 31, 2018 · 1 comment
Open

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

jdj199222 opened this issue Jul 31, 2018 · 1 comment

Comments

@jdj199222
Copy link

在线查询数据功能,如果查询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

@hhyo
Copy link
Contributor

hhyo commented Jul 31, 2018

#89
pr最后一次提交内容可解决这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants