Add large binary, support for native pydantic fields, examples in openapi
0.10.6
✨ Features
-
Add
LargeBinary(max_length)field type #166 -
Add support for normal pydantic fields (including Models) instead of
pydantic_only
attribute which is now deprecated #160.
Pydantic fields should be declared normally as in pydantic model next to ormar fields,
note that (obviously)ormardoes not save and load the value for this field in
database that mean that ONE of the following has to be true:- pydantic field declared on ormar model has to be
Optional(defaults to None) - pydantic field has to have a default value set
- pydantic field has
default_factoryfunction set - ormar.Model with pydantic field has to overwrite
__init__()and provide the value there
If none of the above
ormar(or rather pydantic) will fail during loading data from the database,
with missing required value for declared pydantic field. - pydantic field declared on ormar model has to be
-
Ormar provides now a meaningful examples in openapi schema, including nested models.
The same algorithm is used to iterate related models without looks
as withdict()andselect/load_all. Examples appear also infastapi. #157
🐛 Fixes
- By default
pydanticis not validating fields during assignment,
which is not a desirable setting for an ORM, now allormar.Models
have validation turned-on during assignment (likemodel.column = 'value')
💬 Other
- Add connecting to the database in QuickStart in readme #180
- OpenAPI schema does no longer include
ormar.Modeldocstring as description,
instead just model name is provided if you do not provide your own docstring. - Some performance improvements.