Skip to content

fix(db): import declarative_base/declared_attr from sqlalchemy.orm (ext.declarative is deprecated) #163

Description

@jdmanring

Problem

core/database.py imports from the legacy sqlalchemy.ext.declarative location:

from sqlalchemy.ext.declarative import declarative_base, declared_attr

On SQLAlchemy 2.0 this emits a MovedIn20Warning on every import of core.database:

MovedIn20Warning: The declarative_base() function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 2.0)

Fix

Both names are re-exported from sqlalchemy.orm (verified on 2.0.50):

from sqlalchemy.orm import declarative_base, declared_attr

No behavioral change — same objects, current import path, warning gone.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions