Python SQLite: database is locked

后端 未结 20 1200
一生所求
一生所求 2020-12-12 14:24

I\'m trying this code:

import sqlite

connection = sqlite.connect(\'cache.db\')
cur = connection.cursor()
cur.execute(\'\'\'create table item
  (id integer p         


        
20条回答
  •  青春惊慌失措
    2020-12-12 14:49

    Even when I just had one writer and one reader, my issue was that one of the reads was taking too long: longer than the stipulated timeout of 5 seconds. So the writer timed out and caused the error.

    So, be careful when reading all entries from a database especially from one which the size of the table grows over time.

提交回复
热议问题