New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alembic inconvenient to use programmatically #23

Closed
sqlalchemy-bot opened this Issue Jan 20, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jan 20, 2012

Migrated issue, originally created by Daniel Miller (@millerdev)

I'd like to call alembic commands programmatically, but the config object is proving rather difficult to use that way. Here's my use case: I want to write tests for my migrations. I'd like to use alembic to down/upgrade the database to a particular revision and then run some tests on the db to verify that things look right. Am I overlooking something obvious, or is there no good way to make alembic do its thing without a config file on disk?

The root of the problem seems to be the tight coupling to ConfigParser, as a fundamentally file-based structure. It would be nice to support a simpler programmatic configuration object such as a plain dict.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 20, 2012

Michael Bayer (@zzzeek) wrote:

The config file dependency is an oversight and is resolved in [[https://bitbucket.org/zzzeek/alembic/changeset/38368e8f9a306ba9dfa668dcc8cfaef5d2f031b1|38368e8f9a306ba9dfa668dcc8cfaef5d2f031b1]]. The file no longer needs to be passed, the existing method set_main_option() as well as a new method set_section_option() can be used to assign values (or not).

Plain dict is a little tougher here since we are using sections. It is possible to make individual sections available as dictionaries, or maybe use a dictionary of dictionaries, though this seems a little redundant... Python's config parser just provides the one interface.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 20, 2012

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment