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
This commit is contained in:
Sergey Golitsynskiy
2021-05-18 19:00:55 -04:00
parent 3cd1c7f1c7
commit 680db562f7
+1 -1
View File
@@ -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.'