On Jan 14, 2008, at 5:30 AM, klaus wrote:
> > Hi all, > sometime since version 0.4.2, the after_update hook of a > MapperExtension fires even if no SQL UPDATE statement is generated. Is > this a bug or a feature? this is a feature, the save_obj() method is including your object but no UPDATE is emitted because no column-mapped values have changed. However youll notice that before_update() *is* being called, which has to since we dont know yet if we're doing an UPDATE at that point (and before_update() can even change that outcome), so its consistent that after_update() should be called for every before_update() method. > > > In my case, an object is marked as dirty because a backref has > changed, not because of any change in the object itself. A merge(..., > dont_load=True) is also part of the mix. If it's a bug, I'll try to > provide more details. if youd like to do the same check that save_obj() is doing on an object for "changed", just do this: session.is_modified(instance, include_collections=False) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. 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 -~----------~----~----~----~------~----~------~--~---
