Original problem I'm using sqlalchemy in our project. I registered few event listeners for my model like so.
@event.listens_for(Post, 'after_update')
@event.listens_for(Post, 'after_insert')
Somewhere else in the code I update the view_counter property of my model.
post.view_counter += 1
DBSession.flush()
Now, since view_counter is not something I regard as content update, I want to supress firing of after_update event in sqlalchemy for this specific update. Is there a way to do it via ORM or is the only way to just do raw SQL update bypassing ORM entirely?
EDIT
After some poking around I realized there is another problem, the property is set by Postgresql itself
date_last_updated = Column(SA_DateTime, default=DateTime.now, onupdate=DateTime.now, nullable=False, index=True)
Problem
So the question is, how to update a sqlalchemy model without triggering Postgresql update.