Releases: tortoise/tortoise-orm
v0.16.1
-
QuerySetSingle
now has better code completion -
Created Pydantic models will now have the basic validation elements:
required
is correctly populated for required fieldsnullable
is added to the schema where nulls are acceptedmaxLength
for CharFieldsminimum
&maximum
values for integer fields
To get Pydantic to handle nullable/defaulted fields correctly one should do a
**user.dict(exclude_unset=True)
when passing values to a Model class. -
Added
FastAPI
helper that is based on thestarlette
helper but optionally adds helpers to catch and report with proper errorDoesNotExist
andIntegrityError
Tortoise exceptions. -
Allows a Pydantic model to exclude all read-only fields by setting
exclude_readonly=True
when callingpydantic_model_creator
. -
a Tortoise
PydanticModel
now provides two extra helper functions:from_queryset
: Returns aList[PydanticModel]
which is the format that e.g. FastAPI expectsfrom_queryset_single
: allows one to avoid callingawait
multiple times to get the object and all its related items.
v0.16.0
This release drops support for Python 3.6:
Tortoise ORM now requires a minimum of CPython 3.7
New features:
-
Model docstrings and
#:
comments directly preceding Field definitions are now used as docstrings and DDL descriptions.This is now cleaned and carried as part of the
docstring
parameter indescribe_model(...)
If one doesn't explicitly specify a Field
description=
or ModelMeta.table_description=
then we default to the first line as the description.
This is done because a description is submitted to the DB, and needs to be short (depending on DB, 63 chars) in size. -
Early Partial Init of models.
We now have an early init of models, which can be useful when needing Models that are not bound to a DB, but otherwise complete.
e.g. Schema generation without needing to be properly set up. -
Pydantic serialisation.
We now include native support for automatically building a Pydantic model from Tortoise ORM models.
This will correctly model:- Data Fields
- Relationships (FK/O2O/M2M)
- Callables
At this stage we only suport serialisation, not deserialisation.
For mode information, please see :ref:
contrib_pydantic
- Allow usage of
F
expressions to in annotations. (#301) - Now negative number with
limit(...)
andoffset(...)
raiseParamsError
. (#306) - Allow usage of Function to
queryset.update()
. (#308) - Add ability to supply
distinct
flag to Aggregate (#312)
Bugfixes:
- Fix default type of
JSONField
Removals:
-
Removed
tortoise.aggregation
as this was deprecated since 0.14.0 -
Removed
start_transaction
as it has been broken since 0.15.0 -
Removed support for Python 3.6 / PyPy-3.6, as it has been broken since 0.15.0
If you still need Python 3.6 support, you can install
tortoise-orm<0.16
as we will still backport critical bugfixes to the 0.15 branch for a while.
v0.15.19
v0.15.18
v0.15.17
v0.15.16
v0.15.15
v0.15.14
v0.15.13
- Applies default ordering on related queries
- Fix post-ManyToMany related queries not being evaluated correctly
- Ordering is now preserved on ManyToMany related fetches
- Fix aggregate function on joined table to use correct primary key (#292)
- Fix filtering by backwards FK to use correct primary key