commit()

Overview

Commit any pending transaction to the database.

See also: MariaDB Connector/Python 1.0

DETAILS

Commit any pending transaction to the database. This requires that the connection's autocommit option is first set to False and one or more database-changing statements to have been executed on a cursor associated with the connection. No explicit begin action is needed to start a transaction, as all uncommitted changes are in a pending state that can be either finalized using the connection's commit() call or discarded using the connection's rollback() call.

EXAMPLES

import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',
    )

conn.autocommit = False

# ... make some DB changes here using a cursor object ...

conn.commit()