Add double % for escaped SQLALCHEMY_DATABASE_URI

This commit is contained in:
Mathias Petermann 2020-10-16 10:43:52 +02:00
parent cd29b2b870
commit 55658c5f23
1 changed files with 2 additions and 1 deletions

View File

@ -20,8 +20,9 @@ fileConfig(config.config_file_name)
# target_metadata = mymodel.Base.metadata
from flask import current_app
db_url_escaped = current_app.config.get('SQLALCHEMY_DATABASE_URI').replace('%', '%%')
config.set_main_option(
"sqlalchemy.url", current_app.config.get("SQLALCHEMY_DATABASE_URI")
"sqlalchemy.url", db_url_escaped
)
target_metadata = current_app.extensions["migrate"].db.metadata