Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenStack
oslo
python-oslo.db
Commits
f756a195
Commit
f756a195
authored
Feb 02, 2022
by
Zuul
Committed by
Gerrit Code Review
Feb 02, 2022
Browse files
Merge "Remove use of Session.begin.subtransactions flag"
parents
eec481d7
cd5f697a
Changes
2
Hide whitespace changes
Inline
Side-by-side
oslo_db/sqlalchemy/models.py
View file @
f756a195
...
...
@@ -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
)
...
...
oslo_db/tests/fixtures.py
View file @
f756a195
...
...
@@ -45,11 +45,6 @@ class WarningsFixture(fixtures.Fixture):
message
=
r
'The Session.autocommit parameter is deprecated .*'
,
category
=
sqla_exc
.
SADeprecationWarning
)
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 .*'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment