Skip to content

Commit be4e01c

Browse files
committed
db: Don't use legacy 'Row()' methods
Resolve the following RemovedIn20Warning warnings: The Row.keys() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. Use the namedtuple standard accessor Row._fields, or for full mapping behavior use row._mapping.keys() An additional warning that appears to have been resolved in the interim is also removed. Change-Id: I0c33130a745b986f1bcd2ec177f78e3bb68d2271 Signed-off-by: Stephen Finucane <[email protected]>
1 parent b88ea30 commit be4e01c

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

nova/db/main/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ def _compute_node_fetchall(context, filters=None, limit=None, marker=None):
600600
results = conn.execute(select).fetchall()
601601

602602
# Callers expect dict-like objects, not SQLAlchemy RowProxy objects...
603-
results = [dict(r) for r in results]
603+
results = [dict(r._mapping) for r in results]
604604
conn.close()
605605
return results
606606

nova/tests/fixtures/nova.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -865,18 +865,6 @@ def setUp(self):
865865
message=r'The Column.copy\(\) method is deprecated .*',
866866
category=sqla_exc.SADeprecationWarning)
867867

868-
warnings.filterwarnings(
869-
'ignore',
870-
module='nova',
871-
message=r'The Row.keys\(\) method is considered legacy .*',
872-
category=sqla_exc.SADeprecationWarning)
873-
874-
warnings.filterwarnings(
875-
'ignore',
876-
module='nova',
877-
message=r'Using non-integer/slice indices on Row is deprecated .*',
878-
category=sqla_exc.SADeprecationWarning)
879-
880868
warnings.filterwarnings(
881869
'ignore',
882870
module='nova',

0 commit comments

Comments
 (0)