我可以在 alembic 上使用 .py 文件而不是 .ini 文件吗?

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

我想使用 alembic.py 而不是 alembic.ini 进行配置。
但我找不到任何此类配置的示例。
有什么办法可以不用alembic.ini?

你在找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")