Merge "db: Replace use of 'autoload' parameter"
This commit is contained in:
+3
-2
@@ -4162,7 +4162,7 @@ def _get_fk_stmts(metadata, conn, table, column, records):
|
||||
fk_shadow_tablename = _SHADOW_TABLE_PREFIX + fk_table.name
|
||||
try:
|
||||
fk_shadow_table = schema.Table(
|
||||
fk_shadow_tablename, metadata, autoload=True)
|
||||
fk_shadow_tablename, metadata, autoload_with=conn)
|
||||
except sqla_exc.NoSuchTableError:
|
||||
# No corresponding shadow table; skip it.
|
||||
continue
|
||||
@@ -4257,7 +4257,8 @@ def _archive_deleted_rows_for_table(metadata, tablename, max_rows, before,
|
||||
rows_archived = 0
|
||||
deleted_instance_uuids = []
|
||||
try:
|
||||
shadow_table = schema.Table(shadow_tablename, metadata, autoload=True)
|
||||
shadow_table = schema.Table(
|
||||
shadow_tablename, metadata, autoload_with=conn)
|
||||
except sqla_exc.NoSuchTableError:
|
||||
# No corresponding shadow table; skip it.
|
||||
return rows_archived, deleted_instance_uuids, {}
|
||||
|
||||
@@ -63,7 +63,7 @@ def _create_shadow_tables(migrate_engine):
|
||||
):
|
||||
continue
|
||||
|
||||
table = sa.Table(table_name, meta, autoload=True)
|
||||
table = sa.Table(table_name, meta, autoload_with=migrate_engine)
|
||||
|
||||
columns = []
|
||||
for column in table.columns:
|
||||
@@ -169,13 +169,15 @@ def _create_shadow_tables(migrate_engine):
|
||||
# 252_add_instance_extra_table; we don't create indexes for shadow tables
|
||||
# in general and these should be removed
|
||||
|
||||
table = sa.Table('shadow_instance_extra', meta, autoload=True)
|
||||
table = sa.Table(
|
||||
'shadow_instance_extra', meta, autoload_with=migrate_engine,
|
||||
)
|
||||
idx = sa.Index('shadow_instance_extra_idx', table.c.instance_uuid)
|
||||
idx.create(migrate_engine)
|
||||
|
||||
# 373_migration_uuid; we should't create indexes for shadow tables
|
||||
|
||||
table = sa.Table('shadow_migrations', meta, autoload=True)
|
||||
table = sa.Table('shadow_migrations', meta, autoload_with=migrate_engine)
|
||||
idx = sa.Index('shadow_migrations_uuid', table.c.uuid, unique=True)
|
||||
idx.create(migrate_engine)
|
||||
|
||||
|
||||
Vendored
-6
@@ -841,12 +841,6 @@ class WarningsFixture(fixtures.Fixture):
|
||||
message=r'The Engine.execute\(\) method is considered legacy',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
message=r'The autoload parameter is deprecated .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
module='nova',
|
||||
|
||||
@@ -5714,8 +5714,10 @@ class ArchiveTestCase(test.TestCase, ModelsObjectComparatorMixin):
|
||||
|
||||
shadow_table_name = f'shadow_{table_name}'
|
||||
|
||||
table = sa.Table(table_name, metadata, autoload=True)
|
||||
shadow_table = sa.Table(shadow_table_name, metadata, autoload=True)
|
||||
table = sa.Table(table_name, metadata, autoload_with=self.engine)
|
||||
shadow_table = sa.Table(
|
||||
shadow_table_name, metadata, autoload_with=self.engine,
|
||||
)
|
||||
|
||||
columns = {c.name: c for c in table.columns}
|
||||
shadow_columns = {c.name: c for c in shadow_table.columns}
|
||||
|
||||
Reference in New Issue
Block a user