Description:
For the test I use Python 3.4.2 Shell
I try to receive more then 44000 records from MySql Server (5.5.28-log).
In result I catch error:
ValueError: invalid literal for int() with base 10: b'8783402\n\x00\x00\x00'
How to repeat:
Use Python 3.4.2 Shell (32 bit) in windows x64.
Bellow the output of the shell:
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import mysql.connector as connector
>>> connection = connector.connect(host="*****", database="*****", password="*****", user="*****")
>>> cursor = connection.cursor()
>>> cursor.execute("SELECT series_id FROM series WHERE status <> 'X'")
>>> rows = {r[0] for r in cursor}
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
rows = {r[0] for r in cursor}
File "<pyshell#4>", line 1, in <setcomp>
rows = {r[0] for r in cursor}
File "C:\Program Files (x86)\Python\lib\site-packages\mysql\connector\cursor.py", line 809, in fetchone
row, self.description)
File "C:\Program Files (x86)\Python\lib\site-packages\mysql\connector\conversion.py", line 394, in row_to_python
result[i] = self._cache_field_types[field_type](row[i], field)
File "C:\Program Files (x86)\Python\lib\site-packages\mysql\connector\conversion.py", line 421, in _INT_to_python
return int(value)
ValueError: invalid literal for int() with base 10: b'8783402\n\x00\x00\x00'
>>>
If I set the limit = 1000 then all work correct:
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import mysql.connector as connector
>>> connection = connector.connect(host="*****", database="*****", password="*****", user="*****")
>>> cursor = connection.cursor()
>>> cursor.execute("SELECT series_id FROM series WHERE status <> 'X' LIMIT 1000")
>>> rows = {r[0] for r in cursor}
>>> len(rows)
1000