Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using alembic check with multidb script #1234

Closed
spladug opened this issue May 5, 2023 · 3 comments
Closed

Error using alembic check with multidb script #1234

spladug opened this issue May 5, 2023 · 3 comments
Labels
bug Something isn't working command interface

Comments

@spladug
Copy link
Contributor

spladug commented May 5, 2023

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!

@spladug spladug added the requires triage New issue that requires categorization label May 5, 2023
@CaselIT CaselIT added bug Something isn't working command interface and removed requires triage New issue that requires categorization labels May 5, 2023
@CaselIT
Copy link
Member

CaselIT commented May 5, 2023

Hi,

Thanks for reporting

spladug added a commit to spladug/alembic that referenced this issue Nov 22, 2023
spladug added a commit to spladug/alembic that referenced this issue Nov 22, 2023
@sqla-tester
Copy link
Collaborator

Neil Williams has proposed a fix for this issue in the main branch:

Fix 'alembic check' with multidb env https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4979

@zzzeek
Copy link
Member

zzzeek commented Nov 22, 2023

just in time for 1.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working command interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants