From 163b71e019db1124a2c914ebed8891817e227d0c Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Sun, 6 Oct 2024 20:05:20 -0700 Subject: [PATCH] fix(migration): replace unquote with double percentages (#30532) --- superset/migrations/env.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/migrations/env.py b/superset/migrations/env.py index a92b3a1cb69f0..295eb85d1f883 100755 --- a/superset/migrations/env.py +++ b/superset/migrations/env.py @@ -16,7 +16,6 @@ # under the License. import logging import time -import urllib.parse from logging.config import fileConfig from alembic import context @@ -43,8 +42,9 @@ "SQLite Database support for metadata databases will \ be removed in a future version of Superset." ) -decoded_uri = urllib.parse.unquote(DATABASE_URI) -config.set_main_option("sqlalchemy.url", decoded_uri) +# Escape % chars in the database URI to avoid interpolation errors in ConfigParser +escaped_uri = DATABASE_URI.replace("%", "%%") +config.set_main_option("sqlalchemy.url", escaped_uri) target_metadata = Base.metadata # pylint: disable=no-member