Merge "db: Avoid relying on autobegin"
This commit is contained in:
commit
a0559af692
|
@ -4259,8 +4259,10 @@ def _get_fk_stmts(metadata, conn, table, column, records):
|
|||
# Create the shadow table for the referencing table.
|
||||
fk_shadow_tablename = _SHADOW_TABLE_PREFIX + fk_table.name
|
||||
try:
|
||||
fk_shadow_table = schema.Table(
|
||||
fk_shadow_tablename, metadata, autoload_with=conn)
|
||||
with conn.begin():
|
||||
fk_shadow_table = schema.Table(
|
||||
fk_shadow_tablename, metadata, autoload_with=conn,
|
||||
)
|
||||
except sqla_exc.NoSuchTableError:
|
||||
# No corresponding shadow table; skip it.
|
||||
continue
|
||||
|
@ -4368,9 +4370,10 @@ def _archive_deleted_rows_for_table(
|
|||
rows_archived = 0
|
||||
deleted_instance_uuids = []
|
||||
try:
|
||||
shadow_table = schema.Table(
|
||||
shadow_tablename, metadata, autoload_with=conn,
|
||||
)
|
||||
with conn.begin():
|
||||
shadow_table = schema.Table(
|
||||
shadow_tablename, metadata, autoload_with=conn,
|
||||
)
|
||||
except sqla_exc.NoSuchTableError:
|
||||
# No corresponding shadow table; skip it.
|
||||
conn.close()
|
||||
|
|
Loading…
Reference in New Issue