On Friday, January 11, 2013 2:34:09 AM UTC-4, Michael Bayer wrote: > > > > you can associate the instance event with the mapper() callable or > Mapper class, and it will take effect for all mapped classes.
I think that would work for my case, although I'm a little fuzzy as to the exact syntax to provide the mapper reference for event.listen - I've just been using declarative and haven't dealt with mappers directly - each of my classes would have a different mapper instance, and I'd have to attach to each (no benefit over class attachment)? Or using the Mapper class itself would trigger for anything mapped, and I'd have to discriminate in the handler for classes of interest, or create a Mapper subclass and somehow have my declarative_base subclass use it? > Using 0.8 you can also associate the listener with a common base class, > such as your declarative Base, or even a mixin that's common to some subset > of classes. > That sounds even nicer, and since I'm just starting out with no legacy code I've been meaning to try dropping 0.8 in even before it is final. It sounds like I could just do something like event.listen(MyDeclarativeSubclass, "load", myStamperFunc). -- 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/-/Npq3NDrxh10J. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.