On Thu Jun 12 13:07:25 2014, nicola loddo wrote: > Hy. I don't now if this is the correct post for do this question, but > I have a problem like this. > Until today I used alembic in a project and had worked perfectly, the > db contain tables created previously than aren't in the models object > of my project, but whenever I do a migration with autogenerate, > alembic donìt detect them. > But today I do a migration and in the upgrade Alembic try to dropped > every table not reflected in my models. I don't understand why > > Il giorno venerdì 3 febbraio 2012 18:50:54 UTC+1, André Dieb ha scritto: > > Hello, > > I'm trying to start using alembic for future migrations, replacing > sqlalchemy-migrate. > > My database is already very populated and I tried to follow the > Tutorial steps, starting by initing it, then configuring env.py to > autogenerate revisions. > > My problem is: when I run revision --autogenerate, it detects all my > tables as deleted and in the end detects some changes correctly. How > do I tell alembic my tables already exist?
well if you want alembic to ignore certain tables that are otherwise not mentioned anywhere, you set up an include_object function that filters out what it should look at and what it doesn't: http://alembic.readthedocs.org/en/latest/api.html#alembic.environment.EnvironmentContext.configure.params.include_object that's if these tables aren't represented in the MetaData / declarative Base that you are setting up for "target_metadata". If we're talking here about tables/classes that are part of your model, then you'd need to make sure they're part of that target_metadata. The fact that these tables are suddenly showing up though indicates that something changed, maybe you have a bunch of model classes that are suddenly not being imported or something. > > Thanks in advance > > -- > 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.