MCPcopy
hub / github.com/tortoise/tortoise-orm / update

Method update

tortoise/queryset.py:758–779  ·  view source on GitHub ↗

Update all objects in QuerySet with given kwargs. .. admonition: Example: .. code-block:: py3 await Employee.filter(occupation='developer').update(salary=5000) Will instead of returning a resultset, update the data in the DB itself.

(self, **kwargs: Any)

Source from the content-addressed store, hash-verified

756 )
757
758 def update(self, **kwargs: Any) -> UpdateQuery:
759 """
760 Update all objects in QuerySet with given kwargs.
761
762 .. admonition: Example:
763
764 .. code-block:: py3
765
766 await Employee.filter(occupation='developer').update(salary=5000)
767
768 Will instead of returning a resultset, update the data in the DB itself.
769 """
770 return UpdateQuery(
771 db=self._db,
772 model=self.model,
773 update_kwargs=kwargs,
774 q_objects=self._q_objects,
775 annotations=self._annotations,
776 custom_filters=self._custom_filters,
777 limit=self._limit,
778 orderings=self._orderings,
779 )
780
781 def count(self) -> CountQuery:
782 """

Callers 15

_initMethod · 0.80
_init_configMethod · 0.80
_create_connectionMethod · 0.80
annotateMethod · 0.80
_make_queryMethod · 0.80
_make_queriesMethod · 0.80
add_fieldMethod · 0.80
_dispatch_fieldsMethod · 0.80
_init_relationsMethod · 0.80
get_annotationsFunction · 0.80

Calls 1

UpdateQueryClass · 0.85