@event.listens_for(Comment.message, 'set')
def set(target, value, oldvalue, initiator):
    if target.thread is not None:
        pass
Can SQLAlchemy events be used to update a denormalized data cache?