Return exactly one scalar result or ``None``. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one_or_none`. .. seealso:: :meth:`_engine.ScalarResult.one_or_none` :meth:`_engine.Result.scalars`
(self: Result[_T, Unpack[TupleAny]])
| 1068 | ) |
| 1069 | |
| 1070 | def scalar_one_or_none(self: Result[_T, Unpack[TupleAny]]) -> Optional[_T]: |
| 1071 | """Return exactly one scalar result or ``None``. |
| 1072 | |
| 1073 | This is equivalent to calling :meth:`_engine.Result.scalars` and |
| 1074 | then :meth:`_engine.ScalarResult.one_or_none`. |
| 1075 | |
| 1076 | .. seealso:: |
| 1077 | |
| 1078 | :meth:`_engine.ScalarResult.one_or_none` |
| 1079 | |
| 1080 | :meth:`_engine.Result.scalars` |
| 1081 | |
| 1082 | """ |
| 1083 | return self._only_one_row( |
| 1084 | raise_for_second_row=True, raise_for_none=False, scalar=True |
| 1085 | ) |
| 1086 | |
| 1087 | def one(self) -> Row[Unpack[_Ts]]: |
| 1088 | """Return exactly one row or raise an exception. |