I am attempting to write a library which invokes alembic commands, while 
referencing the migrations of a separate package which has installed said 
library.

The intent here, is for the library to invoke the alembic commands with an 
env.py defined in that package. This seems to work through 
config.get("script_location", "package_name:foldername")
but then obviously expects the actual migrations to be colocated at the 
same location.

My guess would be, if this is possible at all, that there'd be something I 
could put in the env.py which would reconfigure it to execute the 
`context.run_migrations()` migration context (and therefore search path, 
back at the original call site.

I realize that this won't always work, given that env.py is often likely 
customized enough such that a generic one wouldn't be able to execute them, 
but per your cookbook suggestions about programmatic invocation of 
commands, this sort of thing requires the user to opt into changing their 
env.py to use
connectable = context.config.attributes.get("connection", None)
in order to make use of a connection handed to it.

-- 
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-alembic+unsubscr...@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.

Reply via email to