We are using Flask-Migrate(version 3.1.0) from a long time and it used to work fine with our previous flask version BUT after upgrading our Flask version to 2.1.3 it's producing the below error on any flask db
command
Traceback (most recent call last):
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/bin/flask", line 8, in <module>
sys.exit(main())
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask/cli.py", line 986, in main
cli.main()
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask/cli.py", line 567, in main
return super().main(*args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask/cli.py", line 407, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask_migrate/cli.py", line 104, in migrate
_migrate(directory, message, sql, head, splice, branch_label, version_path,
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask_migrate/__init__.py", line 98, in wrapped
f(*args, **kwargs)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/flask_migrate/__init__.py", line 155, in migrate
command.revision(config, message, autogenerate=True, sql=sql,
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/command.py", line 229, in revision
script_directory.run_env()
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/base.py", line 569, in run_env
util.load_python_file(self.dir, "env.py")
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 94, in load_python_file
module = load_module_py(module_id, path)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 110, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "migrations/env.py", line 98, in <module>
run_migrations_online()
File "migrations/env.py", line 92, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/runtime/environment.py", line 853, in run_migrations
self.get_context().run_migrations(**kw)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/runtime/migration.py", line 611, in run_migrations
for step in self._migrations_fn(heads, self):
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/command.py", line 205, in retrieve_migrations
revision_context.run_autogenerate(rev, context)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/autogenerate/api.py", line 526, in run_autogenerate
self._run_environment(rev, migration_context, True)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/autogenerate/api.py", line 544, in _run_environment
if set(self.script_directory.get_revisions(rev)) != set(
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/base.py", line 296, in get_revisions
self.revision_map.get_revisions(id_),
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/revision.py", line 527, in get_revisions
return sum([self.get_revisions(id_elem) for id_elem in id_], ())
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/revision.py", line 527, in <listcomp>
return sum([self.get_revisions(id_elem) for id_elem in id_], ())
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/revision.py", line 552, in get_revisions
return tuple(
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/revision.py", line 553, in <genexpr>
self._revision_for_ident(rev_id, branch_label)
File "/Users/vinitpayal/engineering/tribes/codes/backend-api-python-3/venv/lib/python3.9/site-packages/alembic/script/revision.py", line 613, in _revision_for_ident
assert resolved_id
AssertionError
The error appears on all
flask db migrate -m
flask db upgrade
The error is being raised from a function named _revision_for_ident
in dependency alembic BUT not sure what can be the cause of it and have no idea about how we can get it fixed.
question