防止mysql.cursor.fetchall抛出ValueError吗?

问题描述

所以,这是我的代码

MysqL_cur.execute("select * from view_john")
MysqL_data = MysqL_cur.fetchall()

这是我得到的输出

ValueError: invalid literal for int() with base 0: '000551'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./xyz.py",line 36,in <module>
    MysqL_data = MysqL_cur.fetchall()
  File "/home/john/.local/lib/python3.8/site-packages/MysqL/connector/cursor_cext.py",line 490,in fetchall
    rows = self._cnx.get_rows()
  File "/home/john/.local/lib/python3.8/site-packages/MysqL/connector/connection_cext.py",line 318,in get_rows
    else self._cMysqL.fetch_row()
SystemError: <method 'fetch_row' of '_MysqL_connector.MysqL' objects> returned a result with an error set

我该怎么做才能防止这种情况?我可以在执行SELECT查询时临时更改列类型吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)