Familiar asyncio ORM for python, built with relations in mind
APACHE-2.0 License
Bot releases are hidden (Show)
Published by long2ice over 3 years ago
index
types.force_index
, use_index
to queryset
.F
in update error with update_fields
.delete
query work with limit
and order_by
. (#697)IS NULL
and NOT IS NULL
filters (#700)select_for_update
in update_or_create
. (#702)Model.select_for_update
.__search
full text search to queryset.Published by long2ice over 3 years ago
select_related
when related model specified more than once. (#679)__iter__
to model, now can just return model/models in fastapi
response.in_transaction
bug caused by router
. (#677) (#678)Published by long2ice over 3 years ago
nowait
, skip_locked
, of
parameters to queryset.select_for_update
.Published by long2ice over 3 years ago
update_or_create
.batch_size
parameter for bulk_create
method.Published by long2ice over 3 years ago
Published by abondar almost 4 years ago
Published by long2ice almost 4 years ago
on_delete
in ManyToManyField
. (#508)F
expression in annotate
. (#475)QuerySet.select_related
in case of join same table twice. (#525)Published by abondar about 4 years ago
Published by long2ice about 4 years ago
DateField
accept valid date str.QuerySet.select_for_update()
.default
for not None
on pydantic model creationQuerySet.select_related()
.db_constraint
for RelationalField
family.Published by grigi about 4 years ago
F
expression work with QuerySet.filter()
.py.typed
in source distribution.datetime
parsing from int
for fields.DatetimeField
.get_or_create
passes the using_db=
on if provided.loop
and connection_class
parameters to be passed on to asyncpg.Published by grigi over 4 years ago
tortoise-orm
now installs with no C-dependencies, if you want to use the C accelerators, please do a pip install tortoise-orm[accel]
instead.<instance>.clone()
method that will create a cloned instance in memory. To persist it you still need to call .save()
.clone()
will raise a ParamsError
if tortoise can't generate a primary key. In that case do a .clone(pk=<newval>)
None
and the primary key can be automatically generated, this will create a new record. We however still recommend the .clone()
method instead..save()
can be forced to do a create by setting force_create=True
.save()
can be forced to do an update by setting force_update=True
update_fields
for a .save()
operation will strongly prefer to do an update if possiblePublished by grigi over 4 years ago
Field.default
effect on db level when generate tableBooleanField
default value convertionJSONField
typed in pydantic_model_creator
.sql()
method on QuerySet
Published by grigi over 4 years ago
sqlite://:memory:
in Windows thrown OSError: [WinError 123]
bulk_create()
insertion of records with overridden primary key when the primary key is DB-generatedqueryset.exists()
and Model.exists()
.Model[<pkval>]
that will return the object or raise KeyError
Published by grigi over 4 years ago
basestring
.group_by()
with join nowPublished by grigi over 4 years ago
F
expression in .save()
nowIntEnumField
accept valid int value and CharEnumField
accept valid str valueexclude_raw_fields=True
as it is a critically important field__contains
for non-text fields (e.g. JSONB
)Published by grigi over 4 years ago
Q
expression to function with _filter
parameter on aggregations.group_by()
supportGROUP BY
class is missing for an aggregate with a specified order.Published by grigi over 4 years ago
GROUP BY
class is missing for an aggregate with a specified order.Published by grigi over 4 years ago
TruncationTestCase
now properly quotes table names when it clears them out.app_label
to test initializer(...)
and TORTOISE_TEST_APP
as test environment variable.Published by grigi over 4 years ago
This is a security fix release. We strongly recommend people upgrade.
contains
, starts_with
or ends_with
filters (and their case-insensitive counterparts)contains
, starts_with
or ends_with
filters (and their case-insensitive counterparts)Added support for partial models:
To create a partial model, one can do a .only(<fieldnames-as-strings>)
as part of the QuerySet.
This will create model instances that only have those values fetched.
Persisting changes on the model is allowed only when:
<model>.save(update_fields=[...])
To protect against common mistakes we ensure that errors get raised:
AttributeError
.<model>.save()
a IncompleteInstanceError
will be raised as the model is, as requested, incomplete.<model>.save(update_fields=[...])
and you didn't include the primary key in the .only(...)
,IncompleteInstanceError
will be raised indicating that updates can't be done without the primary key being known.<model>.save(update_fields=[...])
and one of the fields in update_fields
was not in the .only(...)
,IncompleteInstanceError
as that field is not available to be updated..values()
query over a Foreign Key<model>.update_from_dict({...})
that will mass update values safely from a dictionary