I have a timestamp attribute for SQLAlchemy ORM Class.
the class inherit from (AsyncAttrs, DeclarativeBase).
here is my attribute declaration:
timestamp_last_modified: Mapped[datetime] = mapped_column(DateTime, default=func.now(), onupdate=func.now())
I want to have this attribute updated if any of the other attributes of the object get changed.
I use setattr(obj, key)
for example
setattr(person1, name, "newName")
but timestamp is not updated automatically....
also with update function of SQLAlchemy the timestamp is not updated.
which kind of update is needed, to automatically update my timestamp with `onupdate` function?