Return a 'scalar' representation of this selectable, which can be used as a column expression. The returned object is an instance of :class:`_sql.ScalarSelect`. Typically, a select statement which has only one column in its columns clause is eligible to be used as a
(self)
| 3730 | return Exists(self) |
| 3731 | |
| 3732 | def scalar_subquery(self) -> ScalarSelect[Any]: |
| 3733 | """Return a 'scalar' representation of this selectable, which can be |
| 3734 | used as a column expression. |
| 3735 | |
| 3736 | The returned object is an instance of :class:`_sql.ScalarSelect`. |
| 3737 | |
| 3738 | Typically, a select statement which has only one column in its columns |
| 3739 | clause is eligible to be used as a scalar expression. The scalar |
| 3740 | subquery can then be used in the WHERE clause or columns clause of |
| 3741 | an enclosing SELECT. |
| 3742 | |
| 3743 | Note that the scalar subquery differentiates from the FROM-level |
| 3744 | subquery that can be produced using the |
| 3745 | :meth:`_expression.SelectBase.subquery` |
| 3746 | method. |
| 3747 | |
| 3748 | .. versionchanged: 1.4 - the ``.as_scalar()`` method was renamed to |
| 3749 | :meth:`_expression.SelectBase.scalar_subquery`. |
| 3750 | |
| 3751 | .. seealso:: |
| 3752 | |
| 3753 | :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial |
| 3754 | |
| 3755 | """ |
| 3756 | if self._label_style is not LABEL_STYLE_NONE: |
| 3757 | self = self.set_label_style(LABEL_STYLE_NONE) |
| 3758 | |
| 3759 | return ScalarSelect(self) |
| 3760 | |
| 3761 | def label(self, name: Optional[str]) -> Label[Any]: |
| 3762 | """Return a 'scalar' representation of this selectable, embedded as a |
no test coverage detected