hook_base_model
FunctionPrivateSource
hooked_model: type[_Model_contra] = hook_base_model[_Model_contra](
cls: type[_Model_contra],
db: SQLAlchemyProtocol | SQLAlchemyLiteProtocol,
)
Add hooks to the given Model class. This hook will synthesize the
__tablename__, query and query_cls properties if any of them is not
specified in the subclass.
Arguments
Requires
| Argument | Type | Required | |
|---|---|---|---|
cls | type[_Model_contra] | The class to be hooked. | |
db | flask_sqlalchemy.SQLAlchemy | flask_sqlalchemy_lite.SQLAlchemy | The db instance used for providing the session. |
- where
_Model_contrais aTypeVarofDeclarativeBase | DeclarativeBaseNoMeta.
Returns
| Argument | Type | |
|---|---|---|
hooked_model | type[_Model_contra] | The hooked base model class. |