Releases: collerek/ormar
Bug fixes
Improve dates handling and postgres dependencies
0.10.14
✨ Features
- Allow passing
timezone:bool = False
parameter toDateTime
andTime
fields for timezone aware database columns #264 - Allow passing
datetime
,date
andtime
for filter onDateTime
,Time
andDate
fields to allow filtering by datetimes instead of converting the filter value to string #79
🐛 Fixes
- Fix dependencies from
psycopg2
topsycopg2-binary
#255
Fix inherited pk and add field accessor access to relations
0.10.13
✨ Features
- Allow passing field accessors in
select_related
andprefetch_related
aka. python styleselect_related
#225.- Previously:
await Post.objects.select_related(["author", "categories"]).get() await Author.objects.prefetch_related("posts__categories").get()
- Now also:
await Post.objects.select_related([Post.author, Post.categories]).get() await Author.objects.prefetch_related(Author.posts.categories).get()
🐛 Fixes
- Fix overwriting default value for inherited primary key #253
Bug fixes
Get raw data with values and values_list
0.10.11
✨ Features
- Add
values
andvalues_list
toQuerySet
andQuerysetProxy
that allows to return raw data from query #223.- Allow returning list of tuples or list of dictionaries from a query
- Skips parsing the data to ormar model so skips also the validation
- Allow excluding models in between in chain of relations, so you can extract only needed columns
values_list
allows you to flatten the result if you extract only one column.
🐛 Fixes
- Fix creation of auto through model for m2m relation with ForwardRef #226
Generating pydantic models tree and exclude_parent_fields
0.10.10
✨ Features
- Add
get_pydantic
function that allows you to auto generate equivalent pydantic models tree from ormar.Model. This newly generated model tree can be used in requests and responses to exclude fields you do not want to include in the data. - Add
exclude_parent_fields
parameter to model Meta that allows you to exclude fields from parent models during inheritance. Note that best practice is to combine models and mixins but if you have many similar models and just one that differs it might be useful tool to achieve that.
🐛 Fixes
- Fix is null filter with pagination and relations (by @erichaydel) #214
- Fix not saving child object on reverse side of the relation if not saved before #216
💬 Other
- Expand fastapi part of the documentation to show samples of using ormar in requests and responses in fastapi.
- Improve the docs in regard of
default
,ForeignKey.add
etc.
Bump pydantic pin to fix security vulnerability
0.10.9
Important security fix
- Update pin for pydantic to fix security vulnerability CVE-2021-29510
You are advised to update to version of pydantic that was patched.
In 0.10.9 ormar excludes versions with vulnerability in pinned dependencies.
🐛 Fixes
- Fix OpenAPi schema for LargeBinary #204
Bug fixes
0.10.8
🐛 Fixes
New params in dict and base64 encoded strings in LargeBinary
0.10.7
✨ Features
- Add
exclude_primary_keys: bool = False
flag todict()
method that allows to exclude all primary key columns in the resulting dictionaru. #164 - Add
exclude_through_models: bool = False
flag todict()
that allows excluding all through models fromManyToMany
relations #164 - Add
represent_as_base64_str: bool = False
parameter that allows conversion of bytesLargeBinary
field to base64 encoded string. String is returned indict()
,
on access to attribute and string is converted to bytes on setting. Data in database is stored as bytes. #187 - Add
pk
alias to allow field access byModel.pk
in filters and order by clauses (python style)
🐛 Fixes
- Remove default
None
option formax_length
forLargeBinary
field #186 - Remove default
None
option formax_length
forString
field
💬 Other
- Provide a guide and samples of
dict()
parameters in the docs - Major refactor of getting/setting attributes from magic methods into descriptors -> noticeable performance improvement
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)ormar
does 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_factory
function 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
pydantic
is 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.Model
docstring as description,
instead just model name is provided if you do not provide your own docstring. - Some performance improvements.