Alembic can autogenerate migrations. This is probably its most valuable feature. However, I had a situation where
--autogenerate kept on creating migrations for the
databasechangeloglock tables. These are Liquibase tables and should never feature in the Alembic migrations.
The solution was to tell Alembic to ignore these tables by updating the
First create a function that will detect the offending tables.
def include_object(object, name, type_, reflected, compare_to): # Don't include these tables. Add other tables to list as required. return name not in ["databasechangelog", "databasechangeloglock"]
Now pass this function as a callback when configuring the Alembic context.
context.configure( connection=connection, target_metadata=target_metadata, include_object=include_object, )