Skip to content

Commit 5d2399e

Browse files
committed
db: Replace 'insert.inline' parameter with 'Insert.inline()' method
Resolve the following RemovedIn20Warning warning: The insert.inline parameter will be removed in SQLAlchemy 2.0. Please use the Insert.inline() method. Change-Id: Ib5fcb841294b4e20fe085e8603d4132e97be7db9 Signed-off-by: Stephen Finucane <[email protected]>
1 parent c72068d commit 5d2399e

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

nova/db/main/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,10 +4216,10 @@ def _get_fk_stmts(metadata, conn, table, column, records):
42164216
# table insert statements for them and prepend them to the
42174217
# deque.
42184218
fk_columns = [c.name for c in fk_table.c]
4219-
fk_insert = fk_shadow_table.insert(inline=True).from_select(
4219+
fk_insert = fk_shadow_table.insert().from_select(
42204220
fk_columns,
42214221
sql.select(fk_table).where(fk_column.in_(fk_records))
4222-
)
4222+
).inline()
42234223
inserts.appendleft(fk_insert)
42244224
# Create main table delete statements and prepend them to the
42254225
# deque.
@@ -4311,9 +4311,9 @@ def _archive_deleted_rows_for_table(metadata, tablename, max_rows, before,
43114311
# {tablename: extra_rows_archived}
43124312
extras = collections.defaultdict(int)
43134313
if records:
4314-
insert = shadow_table.insert(inline=True).from_select(
4314+
insert = shadow_table.insert().from_select(
43154315
columns, sql.select(table).where(column.in_(records))
4316-
)
4316+
).inline()
43174317
delete = table.delete().where(column.in_(records))
43184318
# Walk FK relationships and add insert/delete statements for rows that
43194319
# refer to this table via FK constraints. fk_inserts and fk_deletes

nova/tests/fixtures/nova.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,12 +895,6 @@ def setUp(self):
895895
message=r'Passing a string to Connection.execute\(\) is .*',
896896
category=sqla_exc.SADeprecationWarning)
897897

898-
warnings.filterwarnings(
899-
'ignore',
900-
module='nova',
901-
message=r'The insert.inline parameter will be removed .*',
902-
category=sqla_exc.SADeprecationWarning)
903-
904898
warnings.filterwarnings(
905899
'ignore',
906900
module='nova',

0 commit comments

Comments
 (0)