does SQLAlchemy have something similar to Django\'s signal concept? Basically, I\'d like to trigger a few functions when I pre-save or post-save some entity objects. Thanks.
You can use inner MapperExtension
class:
class YourModel(db.Model):
class BaseExtension(MapperExtension):
def before_insert(self, mapper, connection, instance):
# do something here
def before_update(self, mapper, connection, instance):
# do something here
__mapper_args__ = { 'extension': BaseExtension() }
# ....