piccolo_orm#
- class starlite.plugins.piccolo_orm.PiccoloORMPlugin#
Bases:
PluginProtocol
[Table
]Support (de)serialization and OpenAPI generation for Piccolo ORM types.
- to_pydantic_model_class(model_class: Type[Table], **kwargs: Any) Type[BaseModel] #
Given a piccolo model_class instance, convert it to a subclass of the piccolo “BaseModel”.
Since incoming request body’s cannot and should not include values for related fields, pk fields and read only fields in piccolo-orm, we generate two different kinds of pydantic models here: - the first is a regular pydantic model, and the other is for the “data” kwarg only, which is further sanitized.
This function uses memoization to ensure we don’t recompute unnecessarily.
- static is_plugin_supported_type(value: Any) TypeGuard[Table] #
Given a value of indeterminate type, determine if this value is supported by the plugin.
- from_pydantic_model_instance(model_class: Type[Table], pydantic_model_instance: BaseModel) Table #
Given an instance of a pydantic model created using the plugin’s
to_pydantic_model_class
, return an instance of the class from which that pydantic model has been created.This class is passed in as the
model_class
kwarg.