Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
EPUB - 136.7Kb
HTML Download (TGZ) - 85.5Kb
HTML Download (Zip) - 103.3Kb


10.2.3 MySQLConnection.commit() Method

This method sends a COMMIT statement to the MySQL server, committing the current transaction. Since by default Connector/Python does not autocommit, it is important to call this method after every transaction that modifies data for tables that use transactional storage engines.


>>> cursor.execute("INSERT INTO employees (first_name) VALUES (%s)", ('Jane'))
>>> cnx.commit()

To roll back instead and discard modifications, see the rollback() method.


User Comments
Sign Up Login You must be logged in to post a comment.