teamniteo / pyramid_deferred_sqla

Opinionated SQLAlchemy + Pyramid integration with deferred configuration in mind.
MIT License
7 stars 5 forks source link

alembic_config directive is hard to use #3

Open MatthewWilkes opened 5 years ago

MatthewWilkes commented 5 years ago

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 https://github.com/niteoweb/pyramid-realworld-example-app/pull/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 commented 5 years ago

The uses cases where I need alembic are:

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 https://github.com/niteoweb/pyramid-realworld-example-app/pull/22.

MatthewWilkes commented 5 years ago

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 commented 5 years ago

@MatthewWilkes: This one can be closed, right?