Skip to content Skip to sidebar Skip to footer

Peewee Says "cannot Commit - No Transaction Is Active"

My CherryPy app does some cleaning every hour with the following code: def every_hour(): two_hours_ago = time.time() - 2 * 60 * 60 DbChoice.delete().where(DbChoice.time_sta

Solution 1:

Looks like the query is automatically committed by default. So Try setting autocommit to False.

db = peewee.SqliteDatabase(path_name + '/doc.db', check_same_thread=False)
db.set_autocommit(False)

http://peewee.readthedocs.org/en/2.0.2/peewee/cookbook.html#changing-autocommit-behavior

Hope this helps!

Post a Comment for "Peewee Says "cannot Commit - No Transaction Is Active""