Skip to content

Releases: collerek/ormar

Bug fixes

21 Jul 12:44
6d0e991
Compare
Choose a tag to compare

0.10.15

🐛 Fixes

  • Fix generating pydantic models tree with nested models (by @pawamoy - thanks!) #278
  • Fix missing f-string in warning about missing primary key field #274
  • Fix passing foreign key value as relation (additional guard, fixed already in the latest release) #270

Improve dates handling and postgres dependencies

06 Jul 13:26
4abd86c
Compare
Choose a tag to compare

0.10.14

✨ Features

  • Allow passing timezone:bool = False parameter to DateTime and Time fields for timezone aware database columns #264
  • Allow passing datetime, date and time for filter on DateTime, Time and Date fields to allow filtering by datetimes instead of converting the filter value to string #79

🐛 Fixes

  • Fix dependencies from psycopg2 to psycopg2-binary #255

Fix inherited pk and add field accessor access to relations

25 Jun 11:42
aa2df39
Compare
Choose a tag to compare

0.10.13

✨ Features

  • Allow passing field accessors in select_related and prefetch_related aka. python style select_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

22 Jun 11:33
cc76e9b
Compare
Choose a tag to compare

0.10.12

🐛 Fixes

  • Fix QuerySet.create method not using init (if custom provided) #245
  • Fix ForwardRef ManyToMany relation setting wrong pydantic type #250

Get raw data with values and values_list

08 Jun 15:29
5316306
Compare
Choose a tag to compare

0.10.11

✨ Features

  • Add values and values_list to QuerySet and QuerysetProxy 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

02 Jun 11:17
85c5b79
Compare
Choose a tag to compare

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

30 May 09:17
6aa9ec9
Compare
Choose a tag to compare

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

18 May 14:43
2267675
Compare
Choose a tag to compare

0.10.8

🐛 Fixes

  • Fix populating default values in pk_only child models #202
  • Fix mypy for LargeBinary fields with base64 str representation #199
  • Fix OpenAPI schema format for LargeBinary fields with base64 str representation #199
  • Fix OpenAPI choices encoding for LargeBinary fields with base64 str representation

New params in dict and base64 encoded strings in LargeBinary

17 May 15:44
2a84a8b
Compare
Choose a tag to compare

0.10.7

✨ Features

  • Add exclude_primary_keys: bool = False flag to dict() method that allows to exclude all primary key columns in the resulting dictionaru. #164
  • Add exclude_through_models: bool = False flag to dict() that allows excluding all through models from ManyToMany relations #164
  • Add represent_as_base64_str: bool = False parameter that allows conversion of bytes LargeBinary field to base64 encoded string. String is returned in dict(),
    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 by Model.pk in filters and order by clauses (python style)

🐛 Fixes

  • Remove default None option for max_length for LargeBinary field #186
  • Remove default None option for max_length for String 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

02 May 13:14
e564acb
Compare
Choose a tag to compare

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.

  • Ormar provides now a meaningful examples in openapi schema, including nested models.
    The same algorithm is used to iterate related models without looks
    as with dict() and select/load_all. Examples appear also in fastapi. #157

🐛 Fixes

  • By default pydantic is not validating fields during assignment,
    which is not a desirable setting for an ORM, now all ormar.Models
    have validation turned-on during assignment (like model.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.