I need to return the ID's of the deleted records on session.query().delete()

I've found this for bulk deletes:

def after_bulk_delete(session, query, query_context, result):
    affected_table = query_context.statement.froms[0]
    affected_rows = query_context.statement.execute().fetchall() 

sqlalchemy.event.listen(Session, "after_bulk_delete", after_bulk_delete)


but this is asynchronous as it uses events.

Isn't there a parameter I can set to get the records as the result of the 
delete operation?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to