Hi all, I am having a problem that is identical to the one mentioned last year on this list: http://groups.google.com/group/sqlalchemy/browse_thread/thread/efd3993c94c8d162/37943cda02151f2b?lnk=gst&q=onupdate+inheritance#37943cda02151f2b
I have Engineer and Manager tables that are inheriting from an Employee table using joined table inheritance. When I update one of the child tables, I want the last_edited timestamp column on the Employee table to be updated as well, but it is not updating. Mr. Bayer proposes the following: """ from sqlalchemy.orm import mapper as _mapper from sqlalchemy.orm import MapperExtension class MyExt(MapperExtension): def before_update(self, mapper, connection, instance): if hasattr(instance, '__before_update__'): instance.__before_update__() def mapper(*args, **kw): kw['extension'] = MyExt() return _mapper(*args, **kw) just hide that code away someplace, and then any instance which defines a method called __before_update__() will have it called before update. """ I've done that step, but I don't understand what the next step is. I thought that I would have to implement a __before_update__ method on my Engineer and Manager classes, which would then call some method on Employee using super. However, when I update my Engineer, it doesn't even look like the __before_update__ method is being called. So I conclude that I'm doing it wrong. Which instances should implement a __before_update__ method? What should the __before_update__ method do? Any advice would be extremely appreciated. Thanks, John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. 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 -~----------~----~----~----~------~----~------~--~---