On Friday, June 9, 2017 at 9:00:00 AM UTC-4, ktang wrote:
>
> Hi,
>
> I have an application migrating existing mysql dbs which may have tables 
> only in some system.
> I am trying to use alembic to handle the migration.
>
> When I migrate the db to a newer version, if I don't want to drop any 
> existing tables or columns, how can I do this (just adding stuff)?
>

I'm assuming you're talking about autogenerate.   If you are just writing 
migration scripts by hand, you just put whatever commands you want in them 
and that does not impact anything else that's already in the database.   If 
you are using autogenerate, and you are comparing a model that's only a 
subset of the real database, you can have autogenerate exclude other tables 
by writing an "include_object" function.  Documentation for this is here: 
http://alembic.zzzcomputing.com/en/latest/api/runtime.html?highlight=include_object#alembic.runtime.environment.EnvironmentContext.configure.params.include_object
 
.  You probably want to look at objects of type "table" and include based 
on a list of names you care about.


 

>
> And a minor issue, when I first setup alembic in my application, I 
> generated an initial migration script which autoincrement is not set in 
> only one of the tables while all other tables are created correctly. 
> Is this a known issue?
>

not really, it depends on the specifics of how your Table metadata is set 
up.  If it's just one table then there is likely something different about 
it in your code.
 

-- 
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.

Reply via email to