dimmg dimmg - 2 months ago 5
Ini Question

.ini file load environment variable

I am using Alembic for migrations implementation in a

project. There is a
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
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.