Hopefully this helps a database admin or developer somewhere:

If you never close your read transaction in SQLAlchemy, you may encounter the following behaviour:

Can perform more SELECTs (get/read) on the table.

Can perform INSERTs (add new rows) on the table.

Cannot DELETE or UPDATE most rows in table

Explanation: Your unclosed SELECT statement has locked the rows, and only those rows, that it has SELECTed, not the table itself.

Session.close() is the fix at the end of your statement list


And to those seeing my posts over the last few months and thinking "what the fuck kind of job does this guy have?"

I couldn't even tell you the answer to that question. It's quite murky...but it's fun! :D

(side note: I get to choose a lot of the way that I spend my day so long as my core responsibilities are handled, and I has ADHD so my interests...are sometimes fleeting :P)

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.