← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2004009] [NEW] SQLAlchemy 2.0 breaks package sqlalchemy-migrate.

 

Public bug reported:

Description
===========
The SQLAlchemy package has recently had a major update, moving its version up to 2.0. Problem is, the change seems to break compatibility with version 1 of the library as now the sqlalchemy-migrate package, which is dependent on it, is reporting missing modules, thus breaking down. Now, the thing is that SQLAlchemy's requirement is the following: 'SQLAlchemy>=1.4.13', which will install the newest version of the package. This requirement needs to be constraint so that it never leaves major version 1.  

Here is an excerpt of the error message reported by sqlalchemy-migrate:
"""
Failed to import test module: nova.tests.unit.volume.test_cinder
Traceback (most recent call last):
  File "/usr/lib64/python3.11/unittest/loader.py", line 407, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/loader.py", line 350, in _get_module_from_name
    __import__(name)
  File "/.../nova/tests/unit/volume/test_cinder.py", line 30, in <module>
    from nova import test
  File "/.../nova/test.py", line 65, in <module>
    from nova.tests import fixtures as nova_fixtures
  File "/.../nova/tests/fixtures/__init__.py", line 16, in <module>
    from .cinder import CinderFixture  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../nova/tests/fixtures/cinder.py", line 24, in <module>
    from nova.tests.fixtures import nova as nova_fixtures
  File "/.../nova/tests/fixtures/nova.py", line 56, in <module>
    from nova.db import migration
  File "/.../nova/db/migration.py", line 22, in <module>
    from migrate import exceptions as migrate_exceptions
  File "/.../.venv/lib64/python3.11/site-packages/migrate/__init__.py", line 11, in <module>
    from migrate.changeset import *
  File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/__init__.py", line 21, in <module>
    from migrate.changeset.schema import *
  File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/schema.py", line 20, in <module>
    from migrate.changeset.databases.visitor import (get_engine_visitor,
  File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
    from migrate.changeset.databases import (sqlite,
  File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/databases/sqlite.py", line 13, in <module>
    from sqlalchemy.databases import sqlite as sa_base
ModuleNotFoundError: No module named 'sqlalchemy.databases'
"""

Here is some information about the SQLAlchemy's new update:
https://www.sqlalchemy.org/blog/2023/01/26/sqlalchemy-2.0.0-released/

Steps to reproduce
==================
1.- python -m venv .venv
2.- . .venv/bin/activate
3.- pip install -e . -r requirements.txt -r test-requirements.txt
4.- python -m unittest discover -p test_* -s .

Expected result
===============
ModuleNotFoundError exception does not happen.

Actual result
=============
Execution of the test discovery is interrupted due to the error.

Environment
===========
Fedora Linux 37 (Workstation Edition) x86_64
Python 3.11.1

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/2004009

Title:
  SQLAlchemy 2.0 breaks package sqlalchemy-migrate.

Status in OpenStack Compute (nova):
  New

Bug description:
  Description
  ===========
  The SQLAlchemy package has recently had a major update, moving its version up to 2.0. Problem is, the change seems to break compatibility with version 1 of the library as now the sqlalchemy-migrate package, which is dependent on it, is reporting missing modules, thus breaking down. Now, the thing is that SQLAlchemy's requirement is the following: 'SQLAlchemy>=1.4.13', which will install the newest version of the package. This requirement needs to be constraint so that it never leaves major version 1.  

  Here is an excerpt of the error message reported by sqlalchemy-migrate:
  """
  Failed to import test module: nova.tests.unit.volume.test_cinder
  Traceback (most recent call last):
    File "/usr/lib64/python3.11/unittest/loader.py", line 407, in _find_test_path
      module = self._get_module_from_name(name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib64/python3.11/unittest/loader.py", line 350, in _get_module_from_name
      __import__(name)
    File "/.../nova/tests/unit/volume/test_cinder.py", line 30, in <module>
      from nova import test
    File "/.../nova/test.py", line 65, in <module>
      from nova.tests import fixtures as nova_fixtures
    File "/.../nova/tests/fixtures/__init__.py", line 16, in <module>
      from .cinder import CinderFixture  # noqa: F401
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/.../nova/tests/fixtures/cinder.py", line 24, in <module>
      from nova.tests.fixtures import nova as nova_fixtures
    File "/.../nova/tests/fixtures/nova.py", line 56, in <module>
      from nova.db import migration
    File "/.../nova/db/migration.py", line 22, in <module>
      from migrate import exceptions as migrate_exceptions
    File "/.../.venv/lib64/python3.11/site-packages/migrate/__init__.py", line 11, in <module>
      from migrate.changeset import *
    File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/__init__.py", line 21, in <module>
      from migrate.changeset.schema import *
    File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/schema.py", line 20, in <module>
      from migrate.changeset.databases.visitor import (get_engine_visitor,
    File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
      from migrate.changeset.databases import (sqlite,
    File "/.../.venv/lib64/python3.11/site-packages/migrate/changeset/databases/sqlite.py", line 13, in <module>
      from sqlalchemy.databases import sqlite as sa_base
  ModuleNotFoundError: No module named 'sqlalchemy.databases'
  """

  Here is some information about the SQLAlchemy's new update:
  https://www.sqlalchemy.org/blog/2023/01/26/sqlalchemy-2.0.0-released/

  Steps to reproduce
  ==================
  1.- python -m venv .venv
  2.- . .venv/bin/activate
  3.- pip install -e . -r requirements.txt -r test-requirements.txt
  4.- python -m unittest discover -p test_* -s .

  Expected result
  ===============
  ModuleNotFoundError exception does not happen.

  Actual result
  =============
  Execution of the test discovery is interrupted due to the error.

  Environment
  ===========
  Fedora Linux 37 (Workstation Edition) x86_64
  Python 3.11.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/2004009/+subscriptions