config.get("script_location", "package_name:foldername")
connectable = context.config.attributes.get("connection", None)
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/5612f1d1-9e93-46ed-9be7-0db362b815a8%40googlegroups.com.
...
connectable = context.config.attributes.get("connection", None)
with self.connection.connect() as connection:
alembic.context.configure(connection=connection)
with alembic.context.begin_transaction():
alembic.context.run_migrations()
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.
So, yes I mean "commands" as in `alembic.command.upgrade()`.The idea would be that the library defines an env.py (e.g. the important portion of which would look something like:)...
connectable = context.config.attributes.get("connection", None)
with self.connection.connect() as connection:
alembic.context.configure(connection=connection)
with alembic.context.begin_transaction():
alembic.context.run_migrations()which lives at `src/library/foo/env.py`. If the migrations were colocated with the env.py, then afaik setting "script_location" to "library:foo" would enable me to run `alembic.command.upgrade()` and it would just work. However in this case (if possible), the migrations/versions/* would live at an arbitrary other location (e.g. the code which has installed this library).
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/598f480c-e977-4ce2-a315-8563aa9944fc%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/598f480c-e977-4ce2-a315-8563aa9944fc%40googlegroups.com.
1. I always expected that, with any reasonably non-trivial app, I would inevitably need to fall back to using their env.py. My hope was that for simpler cases, since this is a testing tool, there would be a way to not require any changes to their env.py by default. Ultimately I can document what the recommended changes to a typical env.py would be, and that's not the end of the world.2. I did try to change version_locations, but unless I'm mistaken what I'm asking for maybe seems like an unsupported usecase. Attempting to target the library env with "script_location" and the local versions/ with "version_locations" still seems to look at the wrong location. Given how ScriptDirectory is constructed and and then `run_env` directly looks for "env.py", it seems like what im asking for is just not an expected usecase.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/99a77147-76da-490a-944d-7f2f40f42fd3%40googlegroups.com.