Don't use the 'Row.keys()' method

Resolve the following RemovedIn20Warning warning:

  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()

Change-Id: I647a57909df56fec7b570ae29efbc731126df14d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-07-19 10:37:39 +01:00
parent 5544f1033f
commit 8772fcc349
2 changed files with 1 additions and 6 deletions

View File

@ -57,11 +57,6 @@ class WarningsFixture(fixtures.Fixture):
message=r'The Executable.execute\(\) method is considered .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'The Row.keys\(\) method is considered legacy .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'Retrieving row members using strings or other .*',

View File

@ -122,7 +122,7 @@ class UpdateMatchTest(db_test_base._DbTestCase):
sql.select(MyModel.__table__).where(MyModel.__table__.c.id == pk)
).first()
values['id'] = pk
self.assertEqual(values, dict(row))
self.assertEqual(values, dict(row._mapping))
def test_update_specimen_successful(self):
uuid = '136254d5-3869-408f-9da7-190e0072641a'