Causes any uncommitted changes on a connection to be discarded.
See also: MariaDB Connector/Python 1.0
Causes any uncommitted changes on a connection to be discarded. This requires that the connection's autocommit option is first set to
False and one or more database-changing statements has 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.
import mariadb conn = mariadb.connect( host = 'localhost', user = 'root', password = 'secret', ) print(conn.autocommit) # Outputs True conn.autocommit = False cursor = conn.cursor() ok = False # ... make some DB changes here using a cursor object ... if ok: conn.commit() else: conn.rollback() # a closed connection also does a rollback