Commit 4f462148 authored by Zuul's avatar Zuul Committed by Gerrit Code Review
Browse files

Merge "Don't use dict-style attribute accesses"

parents 8360df73 5544f103
......@@ -496,7 +496,7 @@ def drop_old_duplicate_entries_from_table(engine, table_name,
is_none = None # workaround for pyflakes
delete_condition &= table.c.deleted_at == is_none
for name in uc_column_names:
delete_condition &= table.c[name] == row[name]
delete_condition &= table.c[name] == row._mapping[name]
rows_to_delete_select = sqlalchemy.sql.select(
table.c.id,
......
......@@ -47,11 +47,6 @@ class WarningsFixture(fixtures.Fixture):
message=r'The Session.begin.subtransactions flag is deprecated .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'Using non-integer/slice indices on Row is deprecated .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'The Engine.execute\(\) method is considered legacy .*',
......
......@@ -327,7 +327,7 @@ class MySQLModeTestCase(db_test_base._MySQLOpportunisticTestCase):
self.connection.execute(self.test_table.insert(),
bar=value)
result = self.connection.execute(self.test_table.select())
return result.fetchone()['bar']
return result.fetchone().bar
def test_string_too_long(self):
value = 'a' * 512
......
......@@ -761,17 +761,19 @@ class TestMigrationUtils(db_test_base._DbTestCase):
base_select = table.select()
rows_select = base_select.where(table.c.deleted != table.c.id)
row_ids = [row['id'] for row in
self.engine.execute(rows_select).fetchall()]
row_ids = [
row.id for row in self.engine.execute(rows_select).fetchall()
]
self.assertEqual(len(expected_values), len(row_ids))
for value in expected_values:
self.assertIn(value['id'], row_ids)
deleted_rows_select = base_select.where(
table.c.deleted == table.c.id)
deleted_rows_ids = [row['id'] for row in
self.engine.execute(
deleted_rows_select).fetchall()]
deleted_rows_ids = [
row.id for row in
self.engine.execute(deleted_rows_select).fetchall()
]
self.assertEqual(len(values) - len(row_ids),
len(deleted_rows_ids))
for value in soft_deleted_values:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment