中文文档 v?
英文文档 v3.x
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Tracking Modifications
Warning
Tracking changes adds significant overhead. In most cases, you’ll be better served by using SQLAlchemy events directly.
Flask-SQLAlchemy can set up its session to track inserts, updates, and deletes for models, then send a Blinker signal with a list of these changes either before or during calls to session.flush()
and session.commit()
.
To enable this feature, set SQLALCHEMY_TRACK_MODIFICATIONS
in the Flask app config. Then add a listener to models_committed
(emitted after the commit) or before_models_committed
(emitted before the commit).
from flask_sqlalchemy.track_modifications import models_committed def get_modifications(sender: Flask, changes: list[tuple[t.Any, str]]) -> None: ... models_committed.connect(get_modifications)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论