Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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()
...
db.init_app(app)
...
db.session.configure(autoflush=False)

But it gives error. How to fix this.

like image 379
user_3068807 Avatar asked Aug 05 '16 18:08

user_3068807


1 Answers

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})
like image 154
r-m-n Avatar answered Sep 17 '22 17:09

r-m-n