Shafaq Shafaq - 1 year ago 307
Python Question

Flask-sqlalchemy disable autoflush for the whole session

I am using Flask-sqlalchemy, how can I just configure it for

no autoflush
. Currently I am doing something like

db = SQLAlchemy()

But it gives error. How to fix this.

Answer Source

The session_options parameter can be used to override session options. If provided it’s a dict of parameters passed to the session’s constructor.

 db = SQLAlchemy(session_options={"autoflush": False})
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download