Alembic – sqlalchemy does not detect existing tables

I had this exact same issue – I don’t know if it still affects you. For me, the problem was caused because the schema I was using was not the default – I think the same thing is happening for you, since you’re using a “Products” schema. I posted an issue at:

https://bitbucket.org/zzzeek/alembic/issue/281/autogenerate-fails-to-detect-existing

And with a little bit of guidance, managed to resolve the problem by passing a parameter include_schemas=True to the EnvironmentContext.configure call in both run_migrations_* functions in the alembic/env.py module.

See the docs:

If True, autogenerate will scan across all schemas located by the
SQLAlchemy get_schema_names() method, and include all differences in
tables found across all those schemas. When using this option, you may
want to also use the EnvironmentContext.configure.include_object
option to specify a callable which can filter the tables/schemas that
get included.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)