简体   繁体   中英

Can I use .py file instead of .ini file on alembic?

I want to use alembic.py for configuration instead of alembic.ini.
But I can't find any example of that type of configuration.
Is there any way to not use alembic.ini?

Are you looking for this :

from alembic.config import Config
alembic_cfg = Config()
alembic_cfg.set_main_option("script_location", "myapp:migrations")
alembic_cfg.set_main_option("url", "postgresql://foo/bar")
alembic_cfg.set_section_option("mysection", "foo", "bar")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM