Search code examples
pythonsqlalchemyalembic

FAILED: Can't locate revision


When I run command

alembic revision --autogenerate -m "Reconciliation and daily amount tables"

It gives me output:

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
ERROR [alembic.util.messaging] Can't locate revision identified by '67ad9835cada'
  FAILED: Can't locate revision identified by '67ad9835cada'

What is the source for the problem?


Solution

  • Problem was with revision, which wasn't located in revisions script directory. If in some way you lost some revision - you can use command alembic stamp 67ad9865deca, where 67ad9865deca revision identifier, which for your database is head of revisions(means if you have higher revision and you wan't to make that migrations). Or just clean tabla alembic_version in your DB, in this case you will tell to alembic that you don't make any migrations yet.