Fix error during DB migration ef71db86c2a1
Error received:
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade b0f952e4a027 -> ef71db86c2a1, Add internal flag column to module_version table and foreign key to module provider to point to latest version
Traceback (most recent call last):
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
self.dialect.do_execute(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
File "venv/lib/python3.8/site-packages/mysql/connector/cursor_cext.py", line 265, in execute
raise errors.ProgrammingError(
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "venv/bin/alembic", line 8, in <module>
sys.exit(main())
File "venv/lib/python3.8/site-packages/alembic/config.py", line 588, in main
CommandLine(prog=prog).main(argv=argv)
File "venv/lib/python3.8/site-packages/alembic/config.py", line 582, in main
self.run_cmd(cfg, options)
File "venv/lib/python3.8/site-packages/alembic/config.py", line 559, in run_cmd
fn(
File "venv/lib/python3.8/site-packages/alembic/command.py", line 320, in upgrade
script.run_env()
File "venv/lib/python3.8/site-packages/alembic/script/base.py", line 563, in run_env
util.load_python_file(self.dir, "env.py")
File "venv/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 92, in load_python_file
module = load_module_py(module_id, path)
File "venv/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 108, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "terrareg/alembic/env.py", line 82, in <module>
run_migrations_online()
File "terrareg/alembic/env.py", line 76, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "venv/lib/python3.8/site-packages/alembic/runtime/environment.py", line 851, in run_migrations
self.get_context().run_migrations(**kw)
File "venv/lib/python3.8/site-packages/alembic/runtime/migration.py", line 620, in run_migrations
step.migration_fn(**kw)
File "terrareg/alembic/versions/ef71db86c2a1_add_internal_flag_column_to_module_.py", line 52, in upgrade
c.execute("""
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1291, in execute
return self._exec_driver_sql(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1595, in _exec_driver_sql
ret = self._execute_context(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
self._handle_dbapi_exception(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
util.raise_(
File "venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
raise exception
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
self.dialect.do_execute(
File "venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
File "venv/lib/python3.8/site-packages/mysql/connector/cursor_cext.py", line 265, in execute
raise errors.ProgrammingError(
sqlalchemy.exc.ProgrammingError: (mysql.connector.errors.ProgrammingError) Not all parameters were used in the SQL statement
[SQL:
UPDATE module_provider
SET latest_version_id=?
WHERE id=?
]
[parameters: (39, 5)]
(Background on this error at: https://sqlalche.me/e/14/f405)