更新时间:2023-11-18 16:55:28
我还不得不切换到PyMySQL.我正在运行pip 1.5.6,Python 2.7.8,并尝试了mysql-connector 2.0.1
I also had to switch to PyMySQL. I am running pip 1.5.6, Python 2.7.8, and tried mysql-connector 2.0.1
我能够从Sequel Pro中运行查询而没有任何问题,但是我的Python查询将仅返回一部分结果,但由于问题中所述的错误而失败.
I was able to run the query from within Sequel Pro with no problems, but my Python query would fail with the error described in the question after returning just a subset of results.
切换到PyMySQL,一切正常.
Switched to PyMySQL and things work as expected.
https://github.com/PyMySQL/PyMySQL
在virtualenv中:
In the virtualenv:
pip install pymysql
在代码中:
import pymysql
connection = pymysql.connect(user='x', passwd='x',
host='x',
database='x')
cursor = connection.cursor()
query = ("MYQUERY")
cursor.execute(query)
for item in cursor:
print item
绝对是mysql-connector-python中的错误.
Definitely a bug in mysql-connector-python.