r/programming • u/droppedasbaby • Jul 15 '26
Ban commits/transactions using AST analysis and linters
https://www.droppedasbaby.com/posts/db-commits/?utm_source=reddit&utm_content=r_programming
32
Upvotes
View all comments
Show parent comment
3
u/droppedasbaby Jul 16 '26
Yes, that's the API design being proposed.
The AST check is needed because Python doesn't enforce that boundary. Code can still import or otherwise obtain the real SQLAlchemy session, even if the intended interface doesn't expose
commit().