I have been working extensively with peewee and postgresql for months. Suddenly this started happening. If I run any query command and get an error, then all subsequent commands start returning peewee.InternalError: current transaction is aborted, commands ignored until end of transaction block
.
I thought this behavior started when I upgraded peewee from 3.5.2 to 3.7.2, but I have since downgraded and the behavior continues. This has definitely not always happened.
In the simplest case, I have a database table with exactly one record. I try to create a new record with the same id and I get an IntegrityError
as expected. If I then try to run any other query commands on that database, I get the InternalError
as above.
This does not happen with an sqlite database.
I have reinstalled peewee and psycopg2, to no avail.
What am I missing?
Try setting autorollback=True
in Database
class. You can follow docs here
Your problem is already known in this issue