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