Skip to content
Advertisement

MySQL Connector methods `fetchone` and `fetchmany` are not PEP 249 compliant

With Python 3.6.2 and MySQL Connector 2.1.6 package on Windows 10, not calling the execute method of a database cursor, or calling it on a non SELECT statement (CREATE, DROP, ALTER, INSERT, DELETE, UPDATE, etc.) yields the following results:

JavaScript

PEP 249 explicitly states for the fetchone, fetchmany and fetchall methods:

An Error (or subclass) exception is raised if the previous call to .execute*() did not produce any result set or no call was issued yet.

So why don’t fetchone and fetchmany raise an exception like fetchall?

Advertisement

Answer

I filed a bug report on bugs.mysql.com and the bug has been fixed in MySQL Connector/Python 8.0.23.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement