Created
March 14, 2016 05:41
-
-
Save guyoun/e2544bc81f346bc498e2 to your computer and use it in GitHub Desktop.
Usage of listens_for() in sqlalchemy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import event | |
@event.listens_for(Model, 'after_update') | |
@event.listens_for(Model, 'after_delete') | |
@event.listens_for(Model, 'after_insert') | |
def receive_after_change(mapper, connection, target): | |
from flask import current_app | |
current_app.logger.info('Model>receive_after_change') | |
from subprocess import call | |
call("touch tmp/reload", shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment