From daeb6cd42b9e0ca5e184b009652a618132d7d38c Mon Sep 17 00:00:00 2001 From: Sergey Golitsynskiy Date: Wed, 13 Oct 2021 17:03:47 -0400 Subject: [PATCH] Fix RemovedIn20Warning: engine.execute() (note) test/unit/data/model/test_mapping.py::TestCleanupEvent::test_table /home/sergey/0dev/galaxy/_galaxy/dev/lib/galaxy/model/view/utils.py:80: RemovedIn20Warning: The Engine.execute() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. All statement execution in SQLAlchemy 2.0 is performed by the Connection.execute() method of Connection, or in the ORM by the Session.execute() method of Session. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) engine.execute(CreateView(view.name, view.__view__)) https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#execute-method-more-strict-execution-options-are-more-prominent --- lib/galaxy/model/migrate/versions/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/model/migrate/versions/util.py b/lib/galaxy/model/migrate/versions/util.py index 1e6e8f478cc..6213cea7d6d 100644 --- a/lib/galaxy/model/migrate/versions/util.py +++ b/lib/galaxy/model/migrate/versions/util.py @@ -200,4 +200,5 @@ def execute_statements(engine, raw_sql): statements = raw_sql if isinstance(raw_sql, list) else [raw_sql] for sql in statements: cmd = DDL(sql) - cmd.execute(bind=engine) + with engine.connect() as connection: + connection.execute(cmd)