MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / alias

Method alias

lib/sqlalchemy/sql/selectable.py:3458–3483  ·  view source on GitHub ↗

Return a new :class:`_expression.Values` construct that is a copy of this one with the given name. This method is a VALUES-specific specialization of the :meth:`_expression.FromClause.alias` method. .. seealso:: :ref:`tutorial_using_aliases`

(self, name: Optional[str] = None, flat: bool = False)

Source from the content-addressed store, hash-verified

3456
3457 @_generative
3458 def alias(self, name: Optional[str] = None, flat: bool = False) -> Self:
3459 """Return a new :class:`_expression.Values`
3460 construct that is a copy of this
3461 one with the given name.
3462
3463 This method is a VALUES-specific specialization of the
3464 :meth:`_expression.FromClause.alias` method.
3465
3466 .. seealso::
3467
3468 :ref:`tutorial_using_aliases`
3469
3470 :func:`_expression.alias`
3471
3472 """
3473 non_none_name: str
3474
3475 if name is None:
3476 non_none_name = _anonymous_label.safe_construct(id(self), "anon")
3477 else:
3478 non_none_name = name
3479
3480 self.name = non_none_name
3481 self.named_with_column = True
3482 self._unnamed = False
3483 return self
3484
3485 @_generative
3486 def lateral(self, name: Optional[str] = None) -> Self:

Callers

nothing calls this directly

Calls 1

safe_constructMethod · 0.80

Tested by

no test coverage detected