You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FastCRUD class expects that the model that's passed to it is a subclass of SQLAlchemy's DeclarativeBase. SQLModel, meanwhile, derives a metaclass from SQLAlchemy's DeclarativeMeta and uses that as its base. It therefore isn't a subclass of DeclarativeBase and passing a class derived from SQLModel to FastCRUD fails type checking:
$ pyright mve.py
.../mve.py
.../mve.py:12:22 - error: Argument of type "type[Store]" cannot be assigned to parameter "model" of type "type[ModelType@FastCRUD]" in function "__init__"
Type "Store" is incompatible with type "DeclarativeBase"
"Store" is incompatible with "DeclarativeBase" (reportArgumentType)
1 error, 0 warnings, 0 informations
To Reproduce
The MVE used to produce the above error message. The documentation says this should work, and it probably does actually run, but again, it fails type checking (using "standard" typeCheckingMode):
Describe the bug or question
The
FastCRUD
class expects that the model that's passed to it is a subclass of SQLAlchemy'sDeclarativeBase
. SQLModel, meanwhile, derives a metaclass from SQLAlchemy'sDeclarativeMeta
and uses that as its base. It therefore isn't a subclass ofDeclarativeBase
and passing a class derived fromSQLModel
toFastCRUD
fails type checking:To Reproduce
The MVE used to produce the above error message. The documentation says this should work, and it probably does actually run, but again, it fails type checking (using "standard"
typeCheckingMode
):The text was updated successfully, but these errors were encountered: