Bug #75979 Cursor returns the error message when it tries to receive more then 44000 record
Submitted: 20 Feb 2015 11:38 Modified: 16 Jul 2015 12:52
Reporter: Leonid Maluitin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:2.0.3 OS:Windows (x64)
Assigned to: CPU Architecture:Any

[20 Feb 2015 11:38] Leonid Maluitin
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
[16 Jul 2015 12:52] Andrii Nikitin
I can't repeat the problem so far with following SQL command in C/Py 2.0.3 for Python 4.1 returns 305809 rows as expected :

SELECT * from mysql.help_topic a, mysql.help_topic b;

Could you confirm if this command above  works for you? If yes - could you provide outputs of following SQL commands:

show create table series\G
show table status like 'series';

Or provide some test case with data which demonstrates the problem?