postgresql – 在Flask-SQLAlchemy中自动提交

前端之家收集整理的这篇文章主要介绍了postgresql – 在Flask-SQLAlchemy中自动提交前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何设置我的Flask应用程序的初始化以将Flask-sqlAlchemy设置为自动提交模式,除非我显式地调用session.begin(),否则不使用事务?

会议“begins a database transaction as soon as it starts communicating”.这对Po​​stgres的影响比MysqL更难吗?

Instagram年,

autocommit mode; in this mode,Psycopg2 won’t issue BEGIN/COMMIT for
any queries; instead,every query runs in its own single-statement
transaction. This is particularly useful for read-only queries where
transaction semantics aren’t needed. It’s as easy as doing:

connection.autocommit = True

This lowered chatter between our application servers and DBs
significantly,and lowered system cpu as well on the database Boxes

我想你可以在Flask-sqlAlchemy中设置autocommit这样做:
from flask.ext.sqlalchemy import sqlAlchemy
db = sqlAlchemy(session_options={'autocommit': True})
原文链接:https://www.f2er.com/postgresql/192837.html

猜你在找的Postgre SQL相关文章