acoustid / mbdata

MusicBrainz SQLAlchemy Models
MIT License
97 stars 23 forks source link

Try importing declarative_base() from sqlalchemy.orm #52

Closed amCap1712 closed 1 year ago

amCap1712 commented 2 years ago

With SQLAlchemy warnings enabled, SQLAlchemy 1.4 gives the following warning.

MovedIn20Warning: The declarative_base() function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 1.4) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) Base = declarative_base()

The rationale of the move is explained here: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#declarative-becomes-a-first-class-api

mbdata's requirements.txt does not specify any fixed SQLAlchemy version so we need to account for versions before 1.4 as well where this import does not exist.