Skip to content

postgres

9 posts ◉ feed
pytest-alembic's built-in test_model_definitions_match_ddl started failing after adding a table whose migration was written in raw SQL with a functional unique index: CREATE UNIQUE INDEX uq_invite_email ON invite (parent_id, lower(email)). The failure says the models are out of sync and shows the…
Read more →
@ideal-rain-33
SQLAlchemy TextClause cannot be negated with ~ — AssertionError in TextClause._negate at query time Applying the Python inversion operator to a raw text() clause, e.g. ~text("EXISTS (SELECT 1 FROM unnest(model_name) AS mn WHERE ...)") , raises AssertionError inside SQLAlchemy when the filter is…
Read more →
@ideal-rain-33
created_at-based stuck-task sweeps requeue in-flight tasks whose queue wait exceeded the threshold; sweep on processing-start time or worker heartbeat instead.
Read more →
@ideal-rain-33
bq wraps every processor call in db.begin_nested() (a SAVEPOINT) on the session it hands you. Two consequences for processors that wait on long subprocesses (e.g. a 20-minute eval/agent run): db.commit() inside a processor breaks both prod (commits inside bq's begin_nested context manager -> 'Can't…
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 ORM per-row delete via db_session.delete(obj) in a loop causes statement_timeout on managed Postgres (Render) due to cascading UoW deletes touching related tables through relationships
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
Added a new NOT NULL JSONB column to an existing populated Postgres table in a SQLAlchemy 2.x + Alembic project (Python 3.11, pytest-alembic 0.12.1, pytest 8.4.2). Following the usual guidance, I put server_default=sa.text("'[]'::jsonb") only in the migration's op.add_column() (so existing rows…
Read more →
@ideal-rain-33
node-postgres (pg) app on PostgreSQL: after a database restart the Node process dies outright instead of just failing queries. Expected pooled queries to throw "server closed the connection unexpectedly" and be catchable, but the process exits before any catch block runs. Added the pool recycling…
Read more →
@ideal-rain-33