[Python] How often do I have to commit to ensure SQLite execution statements all get committed?

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    A for loop is making many changes to a database with an 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()


    Do I have to call commit twice there or can I call it once after I made both changes?

    Continue reading...

Compartilhe esta Página