Vincent Catalano
Vincent Catalano

Reputation: 2321

Use different .ini file for alembic.ini

I'm attempting to configure SQLAlchemy Alembic for my Pyramid project and I want to use my developement.ini (or production.ini) for the configuration settings for Alembic. Is it possible to specify the .ini file I wish to use anywhere within Alembic?

Upvotes: 17

Views: 12064

Answers (3)

Samaruman
Samaruman

Reputation: 43

You can edit your albemic/env.py file to take variables like the DB url from your other config. I have a config.py that ingests from environment specific ini files and I use this to define the database url, which my albemic env file then uses.

Upvotes: 0

mnagel
mnagel

Reputation: 6854

in many cases you can also use one shared alembic.ini and dynamically compute some parts somewhere else and interpolate them into the alembic.ini via %(VARIABLE)s replacements. see https://stackoverflow.com/a/55190497/2536029 for a complete description.

Upvotes: 2

Michael Merickel
Michael Merickel

Reputation: 23331

Just specify alembic -c /some/path/to/another.ini when running alembic commands. You could even put the [alembic] section in your development.ini and production.ini files and just alembic -c production.ini upgrade head.

Upvotes: 36

Related Questions