MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / select_related

Method select_related

tortoise/queryset.py:980–991  ·  view source on GitHub ↗

Return a new QuerySet instance that will select related objects. If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection.

(self, *fields: str)

Source from the content-addressed store, hash-verified

978 return queryset
979
980 def select_related(self, *fields: str) -> QuerySet[MODEL]:
981 """
982 Return a new QuerySet instance that will select related objects.
983
984 If fields are specified, they must be ForeignKey fields and only those
985 related objects are included in the selection.
986 """
987
988 queryset = self._clone()
989 for field in fields:
990 queryset._select_related.add(field)
991 return queryset
992
993 def force_index(self, *index_names: str) -> QuerySet[MODEL]:
994 """

Calls 2

_cloneMethod · 0.95
addMethod · 0.80