Skip to content

Error using alembic check with multidb script #1234

@spladug

Description

@spladug

Describe the bug

Running alembic check in an environment based on the multidb template results in an error.

Expected behavior

It should report on migrations needed for each database.

To Reproduce

Bootstrap a new environment using the multidb template and wire up two databases. Then run alembic check against the environment.

Error

$ alembic --version
alembic 1.10.4
$ alembic check
INFO  [alembic.env] Migrating database user_db
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.env] Migrating database loadshape_db
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
  File "/src/.venv/bin/alembic", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/src/.venv/lib/python3.11/site-packages/alembic/config.py", line 591, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/src/.venv/lib/python3.11/site-packages/alembic/config.py", line 585, in main
    self.run_cmd(cfg, options)
  File "/src/.venv/lib/python3.11/site-packages/alembic/config.py", line 562, in run_cmd
    fn(
  File "/src/.venv/lib/python3.11/site-packages/alembic/command.py", line 290, in check
    diffs = migration_script.upgrade_ops.as_diffs()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.11/site-packages/alembic/operations/ops.py", line 2569, in upgrade_ops
    raise ValueError(
ValueError: This MigrationScript instance has a multiple-entry list for UpgradeOps; please use the upgrade_ops_list attribute.

Versions.

  • OS: Linux
  • Python: 3.11.2
  • Alembic: 1.10.4
  • SQLAlchemy: 2.0.12
  • Database: PostgreSQL 15
  • DBAPI: Psycopg2 or asyncpg

Have a nice day!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions