ModelProtocol
TypeSource
model: ModelProtocol
Protocol compatible with
flask_sqlalchemy.extensions._FSAModel
.
This protocol contains the general functionality of the model prototype. Flask SQLAlchemy does not use the native SQLAlchemy model but defines its own version. That's why we need this protocol for the compatibility issue.
Note that this protocol does not cover every functionality of the Flask SQLAlchemy model for the compaiblity of a regular base model from SQLAlchemy.
Aliases
This type can be acquired by
import flask_sqlalchemy_compat as fsc
fsc.ModelProtocol
fsc.protocols.ModelProtocol
Protocol properties
query_class
model.query_class: ClassVar[type[Any]]
Query class used by query
. Defaults to flask_sqlalchemy.SQLAlchemy.Query
.
query_class
model.query: ClassVar[Any]
A SQLAlchemy query for a model. Equivalent to db.session.query(Model)
. Can
be customized per-model by overriding query_class
.
metadata
model.metadata: sa.MetaData
Metadata property synthesized by the flask_sqlalchemy.SQLAlchemy
instance.