MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / label

Method label

lib/sqlalchemy/orm/query.py:717–732  ·  view source on GitHub ↗

Return the full SELECT statement represented by this :class:`_query.Query`, converted to a scalar subquery with a label of the given name. .. seealso:: :meth:`_sql.Select.label` - v2 comparable method.

(self, name: Optional[str])

Source from the content-addressed store, hash-verified

715 )
716
717 def label(self, name: Optional[str]) -> Label[Any]:
718 """Return the full SELECT statement represented by this
719 :class:`_query.Query`, converted
720 to a scalar subquery with a label of the given name.
721
722 .. seealso::
723
724 :meth:`_sql.Select.label` - v2 comparable method.
725
726 """
727
728 return (
729 self.enable_eagerloads(False)
730 ._get_select_statement_only()
731 .label(name)
732 )
733
734 @overload
735 def as_scalar( # type: ignore[overload-overlap]

Callers

nothing calls this directly

Calls 2

enable_eagerloadsMethod · 0.95

Tested by

no test coverage detected