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

mariadb.connect(**Config.config).commit() does not commit to the database and does not return an error

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Cannot Reproduce
    • None
    • N/A
    • DBAPI 2.0
    • None
    • Debian 12
    • 3.11

    Description

      Description: When using mariadb.connect(*Config.config).commit() to commit changes to the database, the commit operation does not take effect. Additionally, no error is returned, making it difficult to diagnose the issue. To work around this problem, I have been using mariadb.connect(*Config.config).cursor().execute("COMMIT"), which successfully commits the changes to the database.

      Steps to Reproduce:

      Establish a connection to the MariaDB database using mariadb.connect(**Config.config).
      Perform some database operations (e.g., insert, update, delete).
      Attempt to commit the changes using connection.commit().
      Observe that the changes are not committed to the database and no error is returned.
      Expected Behavior: The connection.commit() method should commit the changes to the database and return without any issues.

      Actual Behavior: The connection.commit() method does not commit the changes to the database and does not return any error.

      Workaround: To successfully commit the changes, I have been using the following workaround:

      Environment:

      MariaDB version: [10.11.6-MariaDB-0+deb12u1 Debian 12]
      mariadb-connector-python version: [1.1.11]
      Operating System: [ Debian 12]
      Code Example:

      import mariadb
      from config import Config

      connection = mariadb.connect(**Config.config)
      cursor = connection.cursor()
      cursor.execute("INSERT INTO test_table (column1) VALUES ('value1')")

      connection.commit() # This does not commit the changes and does not return an error

      1. Workaround
        cursor.execute("COMMIT") # This successfully commits the changes

      Additional Information: This issue makes it difficult to ensure that database operations are successfully committed, as no error is returned to indicate a failure. The workaround using cursor.execute("COMMIT") is effective, but it is not the expected behavior for committing transactions.

      Attachments

        Activity

          People

            georg Georg Richter
            Cr0c0 Gabriel Diyan
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.