(self)
| 1739 | yield val |
| 1740 | |
| 1741 | async def _execute(self) -> list[Any] | tuple: |
| 1742 | _, result = await self._db.execute_query(*self.query.get_parameterized_sql()) |
| 1743 | columns = [ |
| 1744 | (key, self.resolve_to_python_value(self.model, name)) |
| 1745 | for key, name in self.fields.items() |
| 1746 | ] |
| 1747 | if self._flat: |
| 1748 | func = columns[0][1] |
| 1749 | flatmap = lambda entry: func(entry["0"]) # noqa |
| 1750 | lst_values = list(map(flatmap, result)) |
| 1751 | else: |
| 1752 | listmap = lambda entry: tuple(func(entry[column]) for column, func in columns) # noqa |
| 1753 | lst_values = list(map(listmap, result)) |
| 1754 | |
| 1755 | if self._single: |
| 1756 | if len(lst_values) == 1: |
| 1757 | return lst_values[0] |
| 1758 | if not lst_values: |
| 1759 | if self._raise_does_not_exist: |
| 1760 | raise DoesNotExist(self.model) |
| 1761 | return None # type: ignore |
| 1762 | raise MultipleObjectsReturned(self.model) |
| 1763 | return lst_values |
| 1764 | |
| 1765 | |
| 1766 | class ValuesQuery(FieldSelectQuery, Generic[SINGLE]): |
no test coverage detected