Autocommit in Flask-SQLAlchemy

Since you are using Flask-SQLAlchemy, it has autocommit = False by default. See this code here

It does say that if you want to turn on autocommit to True by default, you will have to override the SQLAlchemy.create_session function.


I think you can set autocommit in Flask-SQLAlchemy doing this:

from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy(session_options={'autocommit': True})

Edit: the 'flask.ext.' form is now depricated (see here)

from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy(session_options={'autocommit': True})