SQLalchemy 2.0 warning in neutron-lib

Bug #2051171 reported by Brian Haley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Unassigned

Bug Description

Running 'tox -e pep8' in neutron-lib or neutron repo generates this new warning:

/home/bhaley/git/neutron-lib/neutron_lib/db/model_base.py:113: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings. Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  BASEV2 = declarative.declarative_base(cls=NeutronBaseV2)

Google eventually points in this direction:

https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html#step-one-orm-declarative-base-is-superseded-by-orm-declarativebase

So moving to use sqlalchemy.orm.DeclarativeBase class is the future.

Might be a little tricky to implement as sqlalchemy is currently pinned in UC:

sqlalchemy===1.4.50

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-lib (master)
Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/906628

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.opendev.org/c/openstack/neutron-lib/+/906627
Committed: https://opendev.org/openstack/neutron-lib/commit/7909696a9042f1624f73119b7431531dde3434e7
Submitter: "Zuul (22348)"
Branch: master

commit 7909696a9042f1624f73119b7431531dde3434e7
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sat Jan 20 02:00:01 2024 +0000

    [sqlalchemy-20] Use sqlalchemy.orm.DeclarativeBase

    ``declarative_base()`` is superseded by ``DeclarativeBase`` class.
    More information in [1].

    [1]https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html#step-one-orm-declarative-base-is-superseded-by-orm-declarativebase

    Closes-Bug: #2051171
    Change-Id: I5ddf9573572e52fe87bbfde9732c5af9ce398188

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by "Rodolfo Alonso <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/906628

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-lib 3.11.0

This issue was fixed in the openstack/neutron-lib 3.11.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.