From 680db562f7f65ad813db67c9fdedcd8c0dadd537 Mon Sep 17 00:00:00 2001 From: Sergey Golitsynskiy Date: Tue, 6 Apr 2021 01:36:12 -0400 Subject: [PATCH] Do not use legacy string interpolation on URL obj This fixes the pgcleanup script and an integration test. The test fails because of an error in the script. The error is caused by incorrect string formatting. The new SQLAlchemy URL object extends collections.namedtuple, and a tuple is incompatible with printf-style formating. Ref: https://github.com/sqlalchemy/sqlalchemy/blob/18dbd6aa12a7eca0acb1e2c4f752088e24d6adae/lib/sqlalchemy/engine/url.py#L36 https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting --- scripts/cleanup_datasets/pgcleanup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cleanup_datasets/pgcleanup.py b/scripts/cleanup_datasets/pgcleanup.py index 21cb488e5b1..410f125ed1c 100755 --- a/scripts/cleanup_datasets/pgcleanup.py +++ b/scripts/cleanup_datasets/pgcleanup.py @@ -991,7 +991,7 @@ class Cleanup: def conn(self): if self.__conn is None: url = make_url(galaxy.config.get_database_url(self.config)) - log.info('Connecting to database with URL: %s' % url) + log.info(f'Connecting to database with URL: {url}') args = url.translate_connect_args(username='user') args.update(url.query) assert url.get_dialect().name == 'postgresql', 'This script can only be used with PostgreSQL.'