News for hackers. Stuff that matters.
Re:Migrating to SQLAlchemy 2.0 by msluyter on Thursday February 18, 2021 @03:32PM (#26185099)
Example: a team I was on was using SQLAlchemy and we had a couple of services, one that did read only queries, and another that did writes and occasionally DDL (rebuilding the table on the fly, (which is unwise but that's a topic for another post.)) Because we didn't understand SQLAlchemy's default semantics, the read side would effectively open a transaction and leave it open, meaning that subsequent DDL statements would block, then causing the entire table to lock. (I think our solution was to use `autocommit=True`, which iirc is now deprecated.)

That said, I really like SQLAlchemy.

Re:Migrating to SQLAlchemy 2.0 by ergo14 on Thursday February 18, 2021 @04:58PM (#26186248)
The trick is to always auto close transactions at the end of the request.