diff options
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 502719b..35b1a87 100644 --- a/oslo_db/tests/fixtures.py +++ b/oslo_db/tests/fixtures.py @@ -44,11 +44,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) |