Rollback doesn't work inside of Jupyter Notebook
Your error handling code looks good to me. I cannot think of what might be causing this, as it seems to be working fine on my side:

![scr1656348894883](https://user-images.githubusercontent.com/119974/175994871-73e0a6a4-ebbc-4470-a085-b67210e402ae.png)

It also works when swapping `PooledPostgresDatabase`. moving **txn.rollback()** to the first line under the **execpt:** fixed it for me.
```
try:
    pass
except Exception as exc:
   txn.rollback()
   e = traceback.format_exc()
   print(f"<p>Error: {exc}</p>{e}")
   query_failed = True
```
I keep getting
```cursor.execute(sql, params or ())
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
```
even though I have queries inside try: except: blocks
```
def get_random_user():
    with db.atomic() as txn:
        query_failed = False
        try:
            user = User.select().order_by(fn.Random()).limit(1).execute()[0]
        except: # catch *all* exceptions
            e = traceback.format_exc()
            print( "<p>Error: %s</p>" % e)
            txn.rollback()
            query_failed = True

        if query_failed:
            print('Get random user failed')
        else:
            return user

print(get_random_user())
```
The only way to reset the database from not issuing the error is to restart the Jupyter Notebook kernal and start from scratch.

Any thoughts or ideas, I think I have the error trapping/rollback setup properly?

Thank you