Skip to content

🎭 Add compatibility with MappedAsDataclass & SQLAlchemy 2.1 #1441

@jd-solanki

Description

@jd-solanki

Note

I removed BUG template so that we can track progress of compatibility

Reference: #1440 #1439

When you run reproducible script provided in #1440 it will print the deprecation warning from SQLAlchemy that stats below:

SADeprecationWarning: When transforming <class '__main__.User'> to a dataclass, attribute(s) 'email', 'hashed_password', 'is_active', 'is_superuser', 'is_verified' originates from superclass <class 'fastapi_users_db_sqlalchemy.SQLAlchemyBaseUserTable'>, which is not a dataclass.  This usage is deprecated and will raise an error in SQLAlchemy 2.1.  When declaring SQLAlchemy Declarative Dataclasses, ensure that all mixin classes and other superclasses which include attributes are also a subclass of MappedAsDataclass. (Background on this error at: https://sqlalche.me/e/20/dcmx)

I suggest checking out detail on given link in above deprecation warning.

fastapi-users will work for now with SA 2.0 with deprecation but in SA 2.1 it will raise an error if we use MappedAsDataclass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions