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

Method _execute

tortoise/queryset.py:1871–1895  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1869 yield val
1870
1871 async def _execute(self) -> list[dict] | dict:
1872 result = await self._db.execute_query_dict(*self.query.get_parameterized_sql())
1873 columns = [
1874 val
1875 for val in [
1876 (alias, self.resolve_to_python_value(self.model, field_name))
1877 for alias, field_name in self._fields_for_select.items()
1878 ]
1879 if not isinstance(val[1], types.LambdaType)
1880 ]
1881
1882 if columns:
1883 for row in result:
1884 for col, func in columns:
1885 row[col] = func(row[col])
1886
1887 if self._single:
1888 if len(result) == 1:
1889 return result[0]
1890 if not result:
1891 if self._raise_does_not_exist:
1892 raise DoesNotExist(self.model)
1893 return None # type: ignore
1894 raise MultipleObjectsReturned(self.model)
1895 return result
1896
1897
1898class RawSQLQuery(AwaitableQuery):

Callers 1

__await__Method · 0.95

Calls 6

DoesNotExistClass · 0.90
get_parameterized_sqlMethod · 0.80
itemsMethod · 0.80
execute_query_dictMethod · 0.45

Tested by

no test coverage detected