From 25ebbf132c16f0068b7b44759ab8a83e0aa38635 Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Fri, 4 Nov 2022 11:59:59 +1100 Subject: [PATCH] Fix handling of passwords with % in the SQLALCHEMY_DATABASE_URI Fix Flask-Migrate ValueError from occurring when a password has '%' characters in it when specified via SQLALCHEMY_DATABASE_URI. --- migrations/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/env.py b/migrations/env.py index 6a10e6d..4742e14 100755 --- a/migrations/env.py +++ b/migrations/env.py @@ -19,7 +19,7 @@ logger = logging.getLogger('alembic.env') # target_metadata = mymodel.Base.metadata from flask import current_app config.set_main_option('sqlalchemy.url', - current_app.config.get('SQLALCHEMY_DATABASE_URI')) + current_app.config.get('SQLALCHEMY_DATABASE_URI').replace("%","%%")) target_metadata = current_app.extensions['migrate'].db.metadata # other values from the config, defined by the needs of env.py,