Skip to content
Discussion options

You must be logged in to vote

session.delete() is a unit of work method and is intercepted by before_delete and after_delete. The do_orm_execute hook only applies to objects passed to session.execute():

https://docs.sqlalchemy.org/en/20/orm/session_events.html#basic-query-interception

SessionEvents.do_orm_execute() is firstly useful for any kind of interception of a query, which includes those emitted by Query with 1.x style as well as when an ORM-enabled 2.0 style select(), update() or delete() construct is delivered to Session.execute()

that is, the delete construct noted at: https://docs.sqlalchemy.org/en/20/core/dml.html#sqlalchemy.sql.expression.delete

the tutorial at https://docs.sqlalchemy.org/en/20/tutorial/…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jonbiemond
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants