diff options
Diffstat (limited to 'oslo_db/sqlalchemy')
-rw-r--r-- | oslo_db/sqlalchemy/enginefacade.py | 15 | ||||
-rw-r--r-- | oslo_db/sqlalchemy/orm.py | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py index f69811b..a2ea27a 100644 --- a/oslo_db/sqlalchemy/enginefacade.py +++ b/oslo_db/sqlalchemy/enginefacade.py @@ -163,7 +163,7 @@ class _TransactionFactory(object): } self._maker_cfg = { 'expire_on_commit': _Default(False), - '__autocommit': True + '__autocommit': False, } self._transaction_ctx_cfg = { 'rollback_reader_sessions': False, @@ -1266,13 +1266,22 @@ class LegacyEngineFacade(object): """ def __init__(self, sql_connection, slave_connection=None, - sqlite_fk=False, autocommit=True, + sqlite_fk=False, autocommit=False, expire_on_commit=False, _conf=None, _factory=None, **kwargs): warnings.warn( "EngineFacade is deprecated; please use " "oslo_db.sqlalchemy.enginefacade", warning.OsloDBDeprecationWarning, stacklevel=2) + + if autocommit is True: + warnings.warn( + 'autocommit support will be removed in SQLAlchemy 2.0 and ' + 'should not be relied on; please rework your code to remove ' + 'reliance on this feature', + warning.OsloDBDeprecationWarning, + stacklevel=2) + if _factory: self._factory = _factory else: @@ -1346,7 +1355,7 @@ class LegacyEngineFacade(object): @classmethod def from_config(cls, conf, - sqlite_fk=False, autocommit=True, expire_on_commit=False): + sqlite_fk=False, autocommit=False, expire_on_commit=False): """Initialize EngineFacade using oslo.config config instance options. :param conf: oslo.config config instance diff --git a/oslo_db/sqlalchemy/orm.py b/oslo_db/sqlalchemy/orm.py index b1ca00a..a5ec4c4 100644 --- a/oslo_db/sqlalchemy/orm.py +++ b/oslo_db/sqlalchemy/orm.py @@ -57,7 +57,7 @@ class Session(sqlalchemy.orm.session.Session): """oslo.db-specific Session subclass.""" -def get_maker(engine, autocommit=True, expire_on_commit=False): +def get_maker(engine, autocommit=False, expire_on_commit=False): """Return a SQLAlchemy sessionmaker using the given engine.""" return sqlalchemy.orm.sessionmaker(bind=engine, class_=Session, |