database is locked

255 views
Skip to first unread message

lin

unread,
Dec 15, 2015, 1:39:30 AM12/15/15
to peewee-orm

I am using peewee:2.7.3.
Running with two python files. These two program will access database sometimes. EX: Durning initial stage.
But sometimes it will occur database is locked error.
How can I handle these situation in the perfect way?

Traceback (most recent call last):

 
File "/home/ubuntu/src/build/amd64/project/target/m/database/sql.py", line 238, in get_user_version
 
File "/usr/local/project/python/lib/python2.7/site-packages/peewee.py", line 3366, in execute_sql
   
self.commit()
 
File "/usr/local/project/python/lib/python2.7/site-packages/peewee.py", line 3212, in __exit__
    reraise
(new_type, new_type(*exc_args), traceback)
 
File "/usr/local/project/python/lib/python2.7/site-packages/peewee.py", line 3359, in execute_sql
    cursor
.execute(sql, params or ())
peewee
.OperationalError: database is locked

Charles Leifer

unread,
Dec 15, 2015, 9:19:30 AM12/15/15
to peewe...@googlegroups.com
Serialize your write transactions, or add a busy handler, or increase the timeout.

You might make sure you're not holding transactions open for longer than you need to.

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lin

unread,
Dec 15, 2015, 9:31:26 AM12/15/15
to peewee-orm
Can you give me some example about these method?

I am not familar with these.

BTW, I am running two python program and access same database using same access module.

Charles於 2015年12月15日星期二 UTC+8下午10時19分30秒寫道:

Charles Leifer

unread,
Dec 15, 2015, 9:36:21 AM12/15/15
to peewe...@googlegroups.com

You'll need to Google around for answers as this is a complex issue that requires an understanding of database locking and transactions.

Reply all
Reply to author
Forward
0 new messages