I have been trying to create a nice decorator for tasks that are methods of models. I want the tasks to run after specific conditions (after_update/insert, with predicates).
I was able to set this up through a series of event hooks starting with "mapper_configured". The problem I have run into is, listening for "after_insert" on a subclass extending DeclarativeBase, only results in calls after insert has been called for, but not after it has been executed. I can listen on the engine to "after_execute", which does seem to give a callback after commit/flush has actually been called, but at this I have no declarativeBase references to the objects that have been inserted, only to the raw sql. Am I missing something? Here are the example files https://github.com/paddymul/sqlalchemy_garden/blob/master/lib/deferred_task.py - the library https://github.com/paddymul/sqlalchemy_garden/blob/master/schemas/deferred_schema.py - an example usage Thanks, Paddy -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/IpLW9LroG6IJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
