Return exactly one scalar result or raise an exception. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one`. .. seealso:: :meth:`_engine.ScalarResult.one` :meth:`_engine.Result.scalars`
(self: Result[_T, Unpack[TupleAny]])
| 1051 | ) |
| 1052 | |
| 1053 | def scalar_one(self: Result[_T, Unpack[TupleAny]]) -> _T: |
| 1054 | """Return exactly one scalar result or raise an exception. |
| 1055 | |
| 1056 | This is equivalent to calling :meth:`_engine.Result.scalars` and |
| 1057 | then :meth:`_engine.ScalarResult.one`. |
| 1058 | |
| 1059 | .. seealso:: |
| 1060 | |
| 1061 | :meth:`_engine.ScalarResult.one` |
| 1062 | |
| 1063 | :meth:`_engine.Result.scalars` |
| 1064 | |
| 1065 | """ |
| 1066 | return self._only_one_row( |
| 1067 | raise_for_second_row=True, raise_for_none=True, scalar=True |
| 1068 | ) |
| 1069 | |
| 1070 | def scalar_one_or_none(self: Result[_T, Unpack[TupleAny]]) -> Optional[_T]: |
| 1071 | """Return exactly one scalar result or ``None``. |