发布于 2018-10-11 21:15:51
Peewee支持使用FOR UPDATE子句,我认为这可能是您想要的。它不会阻止其他客户端读取,但只要持有锁的事务处于打开状态,就会阻止修改。
例如:
with db.atomic():
# lock note.
note = Note.select().where(Note.id == 123).for_update().get()
# As long as lock is held no other client can modify note.https://stackoverflow.com/questions/52765716
复制相似问题