On 7/13/15 12:46 AM, Mikko Ohtamaa wrote:
Hi,
I am trying to use Alembic in a way that the codebase is split to
several Python packages and each package tracks their own tables and
migration history independently. Effective each package has its own
versions and env.py. Is this possible? I assume it is possible as
Alembic is pretty powerful. I think the major issue here is that each
package should have their own migration history table, so they can be
tracked and upgraded independently.
Any pointers how I should approach this issue?
yes. use the approach documented at
http://alembic.readthedocs.org/en/rel_0_7/branches.html#working-with-multiple-bases.
Other issues I become aware is that autogenerate consider tables
outside the package itself "alien" and tries to drop them. Please see
this SO question: http://stackoverflow.com/q/31196631/315168
full control over what objects autogenerate considers is present at
http://alembic.readthedocs.org/en/rel_0_7/api.html?highlight=include_object#alembic.environment.EnvironmentContext.configure.params.include_object.
if you are trying to run autogenerate in such a way that it considers
only individual MetaData objects at a time you probably want to add
customization in your env.py file that takes advantage of the "X"
argument:
http://alembic.readthedocs.org/en/rel_0_7/api.html?highlight=include_object#alembic.environment.EnvironmentContext.get_x_argument.
use this argument to receive which sub-component you want to work on,
and consult that within your include_object function to look at just the
objects that are relevant to that sub-component.
Just for your information Django migrations handle this kind of
situations.
by all means, use Django if it meets your needs.
Cheers,
Mikko
https://opensourcehacker.com
--
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
<mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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.
For more options, visit https://groups.google.com/d/optout.