Hi André -
Key to the "autogenerate" approach is that the MetaData object you pass to Alembic contains in it all the information about the database being reflected. So if the database has tables A, B, and C, the MetaData would need to also have tables named A, B and C, otherwise Alembic autogen would consider those tables to have been removed.
A straightforward way to do this would be to take the MetaData object from your application, after all the Table metadata is present in it for your app. Then add to it the information about existing tables using reflect():
# Load the existing schema
meta.reflect(engine)
What that will do is for every table in your database that isn't already present in the MetaData, a representation will be loaded.
A more specific approach would be to reflect only those tables that are in the existing DB that aren't part of your newer model:
meta.reflect(engine, only=["A", "B", C"])
the above process will effectively load the state of tables A, B, and C as it is, which will prevent them from being considered for change.
Caveats here include that meta.reflect() can be time consuming if the database has many tables. Alembic may at some point include an option such as one to disable "drops" from being invoked with autogenerate, or provide a way to specify which collections of tablenames are up for autogenerate detection and which are not, probably a callable. I've added issue #27 for this which is a very simple feature add. https://bitbucket.org/zzzeek/alembic/issue/27/provide-a-callable-to-autogenerate-that
INFO [alembic.autogenerate] Detected added table u'alembic_version'
Hey Michael,This is awesome. Thank you for taking the time to explain it! I love when project's creator are passionate about their projects.I just used the reflect() and it worked just nicely. The tables are not detected as deleted anymore and the migrations seem okay.Only one thing I noticed was that alembic was detecting alembic table itselfINFO [alembic.autogenerate] Detected added table u'alembic_version'I thought about adding the class to my meta, but it sounded so hacky I'd rather ask. Is there any other better way to ignore the alembic_version table?It seems the table was automatically created sometime between when I init'd the project and created my first migration.