samedi 26 mars 2016

python sqlite3, how often do I have to commit?

I have a for loop that is making many changes to a database with a sqlite manager class I wrote, but I am unsure about how often I have to commit...

for i in list:
    c.execute('UPDATE table x=y WHERE foo=bar
    conn.commit()
    c.execute('UPDATE table x=z+y WHERE foo=bar
    conn.commit()

Basically my question is whether I have to call commit twice there, or if I can just call it once after I have made both changes?

Aucun commentaire:

Enregistrer un commentaire