Skip to content
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_config directive is hard to use #3

Open
MatthewWilkes opened this issue May 16, 2019 · 3 comments
Open

alembic_config directive is hard to use #3

MatthewWilkes opened this issue May 16, 2019 · 3 comments

Comments

@MatthewWilkes
Copy link

The readme says to call config.alembic_config to set up alembic, but it doesn't actually set up alembic. what it does is returns an alembic configuration object that has the script_location main value set, as well as the DB value that's in the current configurator.

It's nice to have a function that creates the alembic configuration, as we've seen in teamniteo/pyramid-realworld-example-app#22 that it can be a bit messy having to create the alembic config. I think it would be nicer if that code was in this package, if at all possible.

The problem, as I see it, is that making this a directive of the Configurator means that it is available at configuration time only, which isn't especially convenient for either testing or standalone alembic invocations.

Am I interpreting the intention of this directive correctly, and do people agree that it should be possible to create an alembic Config without first creating a Pyramid Configurator?

@zupo
Copy link
Member

zupo commented May 16, 2019

The uses cases where I need alembic are:

  • at app start time, check if database is upgraded to head
  • pytest fixtures
  • running pipenv run alembic -c etc/development.ini -n app:main upgrade head and similar.

If we can cover all these three, I'm huge +1 for not requiring users of pyramid_deferred_sqla from doing what is proposed in teamniteo/pyramid-realworld-example-app#22.

@MatthewWilkes
Copy link
Author

Yeah, as soon as I started looking at this I started not liking my solution for 22. I think I'm going to build some helper functions in here and tear that out again.

@zupo
Copy link
Member

zupo commented Aug 16, 2019

@MatthewWilkes: This one can be closed, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants