Familiar asyncio ORM for python, built with relations in mind
nowait
, skip_locked
, of
parameters to queryset.select_for_update
.update_or_create
.batch_size
parameter for bulk_create
method.Model.refresh_from_db
. (#549)aerich
in case of cyclic dependency. (#558)on_delete
in ManyToManyField
. (#508)F
expression in annotate
. (#475)QuerySet.select_related
in case of join same table twice. (#525)DateField
accept valid date str.QuerySet.select_for_update()
.default
for not None
on pydantic model creationQuerySet.select_related()
.db_constraint
for RelationalField
family.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.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 possible