Create a new :class:`_expression.ColumnElement` representing this :class:`_expression.ColumnElement` as it appears in the select list of a descending selectable.
(
self,
selectable: FromClause,
*,
primary_key: ColumnSet,
foreign_keys: Set[KeyedColumnElement[Any]],
name: Optional[str] = None,
key: Optional[str] = None,
name_is_truncatable: bool = False,
compound_select_cols: Optional[Sequence[ColumnElement[Any]]] = None,
**kw: Any,
)
| 1655 | return None |
| 1656 | |
| 1657 | def _make_proxy( |
| 1658 | self, |
| 1659 | selectable: FromClause, |
| 1660 | *, |
| 1661 | primary_key: ColumnSet, |
| 1662 | foreign_keys: Set[KeyedColumnElement[Any]], |
| 1663 | name: Optional[str] = None, |
| 1664 | key: Optional[str] = None, |
| 1665 | name_is_truncatable: bool = False, |
| 1666 | compound_select_cols: Optional[Sequence[ColumnElement[Any]]] = None, |
| 1667 | **kw: Any, |
| 1668 | ) -> typing_Tuple[str, ColumnClause[_T]]: |
| 1669 | """Create a new :class:`_expression.ColumnElement` representing this |
| 1670 | :class:`_expression.ColumnElement` as it appears in the select list of |
| 1671 | a descending selectable. |
| 1672 | |
| 1673 | """ |
| 1674 | if name is None: |
| 1675 | name = self._anon_name_label |
| 1676 | if key is None: |
| 1677 | key = self._proxy_key |
| 1678 | else: |
| 1679 | key = name |
| 1680 | |
| 1681 | assert key is not None |
| 1682 | |
| 1683 | co: ColumnClause[_T] = ColumnClause( |
| 1684 | ( |
| 1685 | coercions.expect(roles.TruncatedLabelRole, name) |
| 1686 | if name_is_truncatable |
| 1687 | else name |
| 1688 | ), |
| 1689 | type_=getattr(self, "type", None), |
| 1690 | _selectable=selectable, |
| 1691 | ) |
| 1692 | |
| 1693 | co._propagate_attrs = selectable._propagate_attrs |
| 1694 | if compound_select_cols: |
| 1695 | co._proxies = list(compound_select_cols) |
| 1696 | else: |
| 1697 | co._proxies = [self] |
| 1698 | if selectable._is_clone_of is not None: |
| 1699 | co._is_clone_of = selectable._is_clone_of.columns.get(key) |
| 1700 | return key, co |
| 1701 | |
| 1702 | def cast(self, type_: _TypeEngineArgument[_OPT]) -> Cast[_OPT]: |
| 1703 | """Produce a type cast, i.e. ``CAST(<expression> AS <type>)``. |
nothing calls this directly
no test coverage detected