MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / cast

Method cast

lib/sqlalchemy/sql/elements.py:1764–1778  ·  lib/sqlalchemy/sql/elements.py::ColumnElement.cast

Produce a type cast, i.e. ``CAST(<expression> AS <type>)``. This is a shortcut to the :func:`_expression.cast` function. .. seealso:: :ref:`tutorial_casts` :func:`_expression.cast` :func:`_expression.type_coerce`

(self, type_: _TypeEngineArgument[_OPT])

Source from the content-addressed store, hash-verified

1762 return key, co
1763
1764 def cast(self, type_: _TypeEngineArgument[_OPT]) -> Cast[_OPT]:
1765 class="st">"""Produce a type cast, i.e. ``CAST(<expression> AS <type>)``.
1766
1767 This is a shortcut to the :func:`_expression.cast` function.
1768
1769 .. seealso::
1770
1771 :ref:`tutorial_casts`
1772
1773 :func:`_expression.cast`
1774
1775 :func:`_expression.type_coerce`
1776
1777 class="st">"""
1778 return Cast(self, type_)
1779
1780 def label(self, name: Optional[str]) -> Label[_T]:
1781 class="st">"""Produce a column label, i.e. ``<columnname> AS <name>``.

Callers 15

_columns_queryMethod · 0.45
_constraint_queryMethod · 0.45
_index_queryMethod · 0.45
_comment_queryMethod · 0.45
_enum_queryMethod · 0.45
_domain_queryMethod · 0.45
_columns_selectMethod · 0.45
colFunction · 0.45

Calls 1

CastClass · 0.85

Tested by 13

check_resultsMethod · 0.36
test_non_functionsMethod · 0.36
test_issue_9451Function · 0.36
exprMethod · 0.36
test_queryMethod · 0.36
column_expressionMethod · 0.36
bind_expressionMethod · 0.36
setup_mappersMethod · 0.36
bind_expressionMethod · 0.36
test_criterionMethod · 0.36