Return exactly one result or raise an exception. Raises :class:`_exc.NoResultFound` if the query selects no rows. Raises :class:`_exc.MultipleResultsFound` if multiple object identities are returned, or if multiple rows are returned for a query that returns only scal
(self)
| 2792 | return self._iter().one_or_none() # type: ignore |
| 2793 | |
| 2794 | def one(self) -> _T: |
| 2795 | """Return exactly one result or raise an exception. |
| 2796 | |
| 2797 | Raises :class:`_exc.NoResultFound` if the query selects no rows. |
| 2798 | Raises :class:`_exc.MultipleResultsFound` if multiple object identities |
| 2799 | are returned, or if multiple rows are returned for a query that returns |
| 2800 | only scalar values as opposed to full identity-mapped entities. |
| 2801 | |
| 2802 | Calling :meth:`.one` results in an execution of the underlying query. |
| 2803 | |
| 2804 | .. seealso:: |
| 2805 | |
| 2806 | :meth:`_query.Query.first` |
| 2807 | |
| 2808 | :meth:`_query.Query.one_or_none` |
| 2809 | |
| 2810 | :meth:`_engine.Result.one` - v2 comparable method. |
| 2811 | |
| 2812 | :meth:`_engine.Result.scalar_one` - v2 comparable method. |
| 2813 | |
| 2814 | """ |
| 2815 | return self._iter().one() # type: ignore |
| 2816 | |
| 2817 | def scalar(self) -> Any: |
| 2818 | """Return the first element of the first result or None |