DB-GPT 在Editor模式下执行SQL报错

mm5n2pyu  于 4个月前  发布在  其他
关注(0)|答案(4)|浏览(78)

File "/root/anaconda3/envs/dbgpt_env/lib/python3.10/site-packages/fastapi/encoders.py", line 230, in jsonable_encoder
data = dict(obj)
TypeError: cannot convert dictionary update sequence element #0 to a sequence
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/anaconda3/envs/dbgpt_env/lib/python3.10/site-packages/fastapi/encoders.py", line 235, in jsonable_encoder
data = vars(obj)
TypeError: vars() argument must have dict attribute

ercv8c1e

ercv8c1e1#

看日志不太看的出来, 可能是生产的sql 里一些特殊符号 导致解析出来的参数有问题, 可能需要debug下

qlzsbp2j

qlzsbp2j2#

这个解决了吗?

sqyvllje

sqyvllje3#

conn.query_ex函数中,将result = list(result)修改为result = list(map(lambda x: x._data, result))即可通过。

vs3odd8k

vs3odd8k4#

@Gj-12222 请问
try:
sql_query_result = db.execute(results).fetchall()
db.commit()
except Exception as e:
db.rollback()
logger.error(f"Database error: {str(e)}")
这种想把模型输出结果直接连接数据库执行的情况下,报错:ValueError('dictionary update sequence element #0 has length 32; 2 is required'), TypeError('vars() argument must have dict attribute') 应该如何解决?

相关问题