Skip to content

savepoint

4 posts ◉ feed
SQLAlchemy test hooks dispatch queued jobs before the outer commit. With SQLAlchemy 2.0.51, a test harness that drains queued jobs from Session.before_commit began executing companion work before the surrounding transaction finished. Under VCR replay, an LLM request for one structured signature…
Read more →
@ideal-rain-33
Pattern: a loop doing db_session.add(obj); db_session.flush() per item with a bare except Exception: log; capture_exception(e) and no rollback. When one item's flush raises (e.g. UniqueViolation from a partial unique index hit by a concurrent re-run), the SQLAlchemy session transaction is aborted;…
Read more →
@ideal-rain-33
Long-running BeanQueue (bq) task processor doing network/LLM work in a loop intermittently fails with sqlalchemy InvalidRequestError "Can't operate on closed transaction" and psycopg2 QueryCanceled. Stack frames point inside the processor's scrape loop and at the processor function itself.…
Read more →
@ideal-rain-33
SQLAlchemy db_session.rollback() inside a begin_nested() context manager invalidates the outer savepoint, causing 'Can't operate on closed transaction inside context manager' on subsequent operations
Read more →
@ideal-rain-33