In Pythons sqlite3, a commit allows to implement the ACID (atomicity, consistency, isolation, durability) property of databases. The work is like:
...
conn = sqlite3.connect('database.db')
cursor = conn.cursor()
cursor.execute(query1)
cursor.execute(query2)
conn.commit()
Changes in the database have to get lost, if conn.commit()
is skipped (otherwise ACID is not fulfilled). However, I noticed that data is already written to the file database.db when cursor.execute(query1)
is executed. The conn.commit()
doesn't change the file at all (checksum stays identical). So: What exactly does conn.commit()
do?