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

execute() with INSERT statement fails after executemany()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0a1
    • Fix Version/s: 1.1.0b1
    • Component/s: DBAPI 2.0
    • Labels:
      None
    • Python Version:
      3.9

      Description

      Since execute() and executemany() use the same callback for retrieving data, array_size needs to be cleared.

      Example:

      import mariadb

      connection= mariadb.connect(db="test")
       
      cursor= connection.cursor()
       
      cursor.execute("create temporary table t1 (a int, b int)")
       
      cursor.executemany("insert into t1 values (?,?)", [(1,2),(3,4)])
       
      cursor.execute("insert into t1 values (?,?)", (4,5))
      

      raises exception:
      mariadb.DataError: Can't access column number 1 at row 1

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration