Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.8
-
None
-
3.8+
Description
When retrieving large datasets with a buffered cursor, it makes sense to close the connection immediately since it will not be used anymore, all data was read from server and processing data inside the application will take a lot of time.
This works fine with PyMySQL:
>>> import pymysql
|
>>> conn=pymysql.connect(user="root")
|
>>> cursor=conn.cursor()
|
>>> cursor.execute("select 1 union select 2")
|
2
|
>>> conn.close()
|
>>> cursor.fetchone()
|
(1,)
|
>>> cursor.fetchone()
|
(2,)
|
While MariaDB Connector/Python throws an exception, since the connection was closed:
>>> import mariadb
|
>>> conn=mariadb.connect(user="root")
|
>>> cursor=conn.cursor()
|
>>> cursor.execute("select 1 union select 2")
|
>>> conn.close()
|
>>> cursor.fetchone()
|
Traceback (most recent call last):
|
...
|
mariadb.ProgrammingError: Invalid connection or not connected
|
>>>
|
This issue was intially reported by a member of PUG Berlin (Sorry, I don't remember the name)