I am using Alembic for migrations implementation in a Flask
project. There is a alembic.ini
file where the database configs must be specified:
sqlalchemy.url = driver://user:password@host/dbname
Is there a way to specify the parameters from the environment variables? I've tried to load them in this way $(env_var)
but with no success. Thanks!
I've solved the problem by setting sqlalchemy.url
in env.py
as @dirn suggested.
config.set_main_option('sqlalchemy.url', <db_uri>)
did the trick, where <db_uri>
can be loaded from environment or config file.