diff options
author | Zuul <zuul@review.opendev.org> | 2022-02-02 21:02:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-02-02 21:02:51 +0000 |
commit | f756a195674f29f4b55b21914263d1ffbbe3b07b (patch) | |
tree | 653779c9d7d56b3ad3d020704b6c96c3c0d19dd5 /oslo_db | |
parent | eec481d7e63d986523f57e3bdd32649caf4a6b2b (diff) | |
parent | cd5f697a173a64df0cdb1a90ab871b81f56469d4 (diff) | |
download | oslo-db-f756a195674f29f4b55b21914263d1ffbbe3b07b.tar.gz |
Merge "Remove use of Session.begin.subtransactions flag"
Diffstat (limited to 'oslo_db')
-rw-r--r-- | oslo_db/sqlalchemy/models.py | 14 | ||||
-rw-r--r-- | oslo_db/tests/fixtures.py | 5 |
2 files changed, 2 insertions, 17 deletions
diff --git a/oslo_db/sqlalchemy/models.py b/oslo_db/sqlalchemy/models.py index 2bad0f5..72ac7cb 100644 --- a/oslo_db/sqlalchemy/models.py +++ b/oslo_db/sqlalchemy/models.py @@ -34,18 +34,8 @@ class ModelBase(object): def save(self, session): """Save this object.""" - - # NOTE(boris-42): This part of code should be look like: - # session.add(self) - # session.flush() - # But there is a bug in sqlalchemy and eventlet that - # raises NoneType exception if there is no running - # transaction and rollback is called. As long as - # sqlalchemy has this bug we have to create transaction - # explicitly. - with session.begin(subtransactions=True): - session.add(self) - session.flush() + session.add(self) + session.flush() def __setitem__(self, key, value): setattr(self, key, value) diff --git a/oslo_db/tests/fixtures.py b/oslo_db/tests/fixtures.py index acc260d..4646278 100644 --- a/oslo_db/tests/fixtures.py +++ b/oslo_db/tests/fixtures.py @@ -47,11 +47,6 @@ class WarningsFixture(fixtures.Fixture): warnings.filterwarnings( 'once', - message=r'The Session.begin.subtransactions flag is deprecated .*', - category=sqla_exc.SADeprecationWarning) - - warnings.filterwarnings( - 'once', message=r'Calling \.begin\(\) when a transaction is already .*', category=sqla_exc.SADeprecationWarning) |