[Python] How to implement 'sqlite3_busy_timeout' in python?

Discussão em 'Python' iniciado por Stack, Setembro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to run a python script with multiple threads, but I'm getting the following error:

    sqlite3.OperationalError: database is locked


    I've found out that I need to extend the sqlite3_busy_timeout to make it wait a bit longer before writing to the database.

    The code used for this looks like the following:

    db.configure("busyTimeout", 10000) # //This should make it wait for 10 seconds.


    What I want to know is how do I implement this code? Where should I place it, before or after the SQLite command? also, do I have to write anything before it? like c.execute("code")?

    Continue reading...

Compartilhe esta Página