hhyo / Archery

SQL 审核查询平台
https://archerydms.com
Apache License 2.0
6.11k stars 1.69k forks source link

SQL在线查询出错Internal Server Error #2798

Open h77626592 opened 2 months ago

h77626592 commented 2 months ago

重现步骤

在SQL查询菜单中操作在线查询,因字段有BLOB类型导致查询报错,是否更友好一些查询时直接提示,方便使用者根据字段查询,

预期外的结果

SQL在线查询出错Internal Server Error

日志文本

[2024-09-10 09:45:51,097][MainThread:140229526841152][task_id:default][exception_logging_middleware.py:12][ERROR]- Traceback (most recent call last):
  File "/opt/archery/common/utils/extend_json_encoder.py", line 103, in default
    return convert(obj)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 909, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 19, 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 "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/query.py", line 196, in query
    json.dumps(
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/__init__.py", line 412, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 105, in default
    return super(ExtendJSONEncoderFTime, self).default(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 272, in default
    raise TypeError('Object of type %s is not JSON serializable' %
TypeError: Object of type LOB is not JSON serializable

2024-09-10 09:45:51,097 - default - ERROR - Traceback (most recent call last):
  File "/opt/archery/common/utils/extend_json_encoder.py", line 103, in default
    return convert(obj)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 909, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 19, 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 "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/query.py", line 196, in query
    json.dumps(
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/__init__.py", line 412, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 105, in default
    return super(ExtendJSONEncoderFTime, self).default(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 272, in default
    raise TypeError('Object of type %s is not JSON serializable' %
TypeError: Object of type LOB is not JSON serializable

2024-09-10 09:45:51,111 - django.request - ERROR - Internal Server Error: /query/
Traceback (most recent call last):
  File "/opt/archery/common/utils/extend_json_encoder.py", line 103, in default
    return convert(obj)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 909, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 19, 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 "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/query.py", line 196, in query
    json.dumps(
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/__init__.py", line 412, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/opt/archery/common/utils/extend_json_encoder.py", line 105, in default
    return super(ExtendJSONEncoderFTime, self).default(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/simplejson/encoder.py", line 272, in default
    raise TypeError('Object of type %s is not JSON serializable' %
TypeError: Object of type LOB is not JSON serializable

版本

1.11.3

部署方式

Docker

是否还有其他可以辅助定位问题的信息?比如数据库版本等

No response

LeoQuote commented 2 months ago

欢迎pr