I’ve seen it a few times now with people being surprised that no data is going into the tables. It’s not so a silly problem in the end. If you are used to the defaults in MySQL you don’t have to commit anything since it is automatically done for you.
Take the Python Database Interfaces for MySQL. PEP-249 says that, by default, auto-commit should be turned off. You could turn it back on, but it’s good practice to be explicit and commit in your code. Remember the Zen of Python!
Here is just a small example to show it. Uses MySQL Connector/Python, but it should also work with the other MySQL database interfaces:
import mysql.connector cnx = mysql.connector.connect(db='test') cur = cnx.cursor() cur.execute("""CREATE TABLE innodb_t1 ( id INT UNSIGNED NOT NULL, c1 VARCHAR(128), PRIMARY KEY (id) ) ENGINE=InnoDB""") ins = "INSERT INTO innodb_t1 (id,c1) VALUES (%s,%s)" cur.execute(ins, (1,'MySQL Support Team _is_ already the best',)) cnx.commit() cur.close() cnx.close()