In Flask-SQLAlchemy, at:
https://pythonhosted.org/Flask-SQLAlchemy/queries.html
you access the session through db.session .
db.session
How to make session access through db.session have
expire_on_commit=False
I tried db.session.expire_on_commit = False , but this does not affect the work.
db.session.expire_on_commit = False
You can use the session_options dictionary when creating the database object.
session_options
db = SQLAlchemy(app, session_options={"expire_on_commit": False})