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

Method fetch_related

tortoise/models.py:1211–1223  ·  view source on GitHub ↗

Fetch related fields. .. code-block:: python3 User.fetch_related("emails", "manager") :param args: The related fields that should be fetched. :param using_db: Specific DB connection to use instead of default bound

(self, *args: Any, using_db: BaseDBAsyncClient | None = None)

Source from the content-addressed store, hash-verified

1209 await self._post_delete(db)
1210
1211 async def fetch_related(self, *args: Any, using_db: BaseDBAsyncClient | None = None) -> None:
1212 """
1213 Fetch related fields.
1214
1215 .. code-block:: python3
1216
1217 User.fetch_related("emails", "manager")
1218
1219 :param args: The related fields that should be fetched.
1220 :param using_db: Specific DB connection to use instead of default bound
1221 """
1222 db = using_db or self._choose_db()
1223 await db.executor_class(model=self.__class__, db=db).fetch_for_list([self], *args)
1224
1225 async def refresh_from_db(
1226 self,

Calls 2

_choose_dbMethod · 0.95
fetch_for_listMethod · 0.45