Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-276

Buffered cursor doesn't work after connection was closed

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.8
    • 1.1.9
    • DBAPI 2.0
    • 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)

      Attachments

        Activity

          People

            georg Georg Richter
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.