>
> 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)