Almost all databases support auto-commit,just that is off bye default in most cases for Python,as mention in 249.
That said it's very easy to turn on in almost all cases.
Understanding Autocommit
PEP 249 Wrote:Note that if the database supports an auto-commit feature, this must be initially off. An interface method may be provided to turn it back on.There is a reason behind this from mailing list,long time ago:
Quote:Auto commit is a bad thing and a pretty evil invention of ODBC.
While it does make writing ODBC drivers simpler (ones which don't support transactions that is),
it is potentially dangerous at times, e.g. take a crashing program: there is no way to recover from errors because the database has no way of knowing which data is valid and which is not.
No commercial application handling "mission critical" (I love that term ;-) data would ever want to run in auto-commit mode.
Quote:ANY serious application MUST manage its own transactions, as otherwise you can't ever hope to control failure modes.Python developers took this sort of information into consideration and decided the benefit of having auto-commit off by default (easier error handling and reversing).
That said it's very easy to turn on in almost all cases.
# PostgreSQL conn.set_session(readonly=True, autocommit=True) # For Flask-SQLAlchemy(what i use most) db = SQLAlchemy(app, session_options={'autocommit': True})SQLAlchemy Python biggest ORM,dos implements it's own auto-commit.
Understanding Autocommit
Quote:SQLAlchemy implements its own “autocommit” feature which works completely consistently across all backends