-
-
Notifications
You must be signed in to change notification settings - Fork 900
Open
Description
The plugin breaks the DeclarativeBase, e.g.:
from typing import Any
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.types import JSON
class Base(DeclarativeBase):
type_annotation_map = {dict[str, Any]: JSON}
db = SQLAlchemy(model_class=Base)
Gives the error:
sqlalchemy.exc.InvalidRequestError: Declarative base class has both a 'registry' attribute and a type_annotation_map entry. Per-base type_annotation_maps are not supported. Please apply the type_annotation_map to this registry directly.
However, type_annotation_map is supported on the base, but by subclassing the base class (something which seems to be happening inside the plugin), it now detects both the registry created from the base class with type_annotation_map and the type_annotation_map. This doesn't happen without the Flask plugin.
Environment:
- Python version: 3.11.6
- Flask-SQLAlchemy version: 3.1.1
- SQLAlchemy version: 2.0.31
samuelhwilliams, gnbezerra and shanepbretz
Metadata
Metadata
Assignees
Labels
No labels