6
在燒瓶SQLAlchemy,它在:瓶SQLAlchemy的設置expire_on_commit =假
https://pythonhosted.org/Flask-SQLAlchemy/queries.html
您通過db.session
訪問到您的會話。
讓你通過db.session
訪問會話如何有
expire_on_commit=False
我試圖db.session.expire_on_commit = False
但這並不appera生效。
您需要使用'SQLALCHEMY_EXPIRE_ON_COMMIT'將它添加到應用程序設置中,但我必須問,爲什麼要這樣做?您期望它做什麼? –