Tag Archives: SQLalchemy

Error: can’t locate revision identified by ‘xxx’

Flask migration using sqlalchemy database error:

Error: Can't locate revision identified by 'xxxxxx'

error reason: the database version is wrong, maybe migrations file is changed, but the original database table is still used.

solution:

  1. delete migrations folder + alembic_version table in the database table, re-initialize the database and update;
  2. delete the entire database table, then you can directly do the database initialization update operation. (migrations folders can also be deleted, equivalent to recreating the database table, the original data will not exist)