class ColumnElement(roles.ColumnArgumentOrKeyRole, roles.StatementOptionRole, roles.WhereHavingRole, roles.BinaryElementRole[
Known subclasses: sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.sql.elements.Case
, sqlalchemy.sql.elements.CollationClause
, sqlalchemy.sql.elements.Extract
, sqlalchemy.sql.elements.False_
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.KeyedColumnElement
, sqlalchemy.sql.elements.Null
, sqlalchemy.sql.elements.OperatorExpression
, sqlalchemy.sql.elements.Over
, sqlalchemy.sql.elements.Slice
, sqlalchemy.sql.elements.True_
, sqlalchemy.sql.elements.Tuple
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.elements.WithinGroup
, sqlalchemy.sql.elements.WrapsColumnExpression
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.selectable.ScalarSelect
, sqlalchemy.sql.selectable.ScalarValues
, sqlalchemy.dialects.mssql.information_schema._cast_on_2005
, sqlalchemy.sql.crud._multiparam_column
, sqlalchemy.sql.elements._label_reference
, sqlalchemy.sql.elements._textual_label_reference
Represent a column-oriented SQL expression suitable for usage in the "columns" clause, WHERE clause etc. of a statement. While the most familiar kind of :class:`_expression.ColumnElement` is the :class:`_schema.Column` object, :class:`_expression.ColumnElement` serves as the basis for any unit that may be present in a SQL expression, including the expressions themselves, SQL functions, bound parameters, literal expressions, keywords such as ``NULL``, etc. :class:`_expression.ColumnElement` is the ultimate base class for all such elements. A wide variety of SQLAlchemy Core functions work at the SQL expression level, and are intended to accept instances of :class:`_expression.ColumnElement` as arguments. These functions will typically document that they accept a "SQL expression" as an argument. What this means in terms of SQLAlchemy usually refers to an input which is either already in the form of a :class:`_expression.ColumnElement` object, or a value which can be **coerced** into one. The coercion rules followed by most, but not all, SQLAlchemy Core functions with regards to SQL expressions are as follows: * a literal Python value, such as a string, integer or floating point value, boolean, datetime, ``Decimal`` object, or virtually any other Python object, will be coerced into a "literal bound value". This generally means that a :func:`.bindparam` will be produced featuring the given value embedded into the construct; the resulting :class:`.BindParameter` object is an instance of :class:`_expression.ColumnElement`. The Python value will ultimately be sent to the DBAPI at execution time as a parameterized argument to the ``execute()`` or ``executemany()`` methods, after SQLAlchemy type-specific converters (e.g. those provided by any associated :class:`.TypeEngine` objects) are applied to the value. * any special object value, typically ORM-level constructs, which feature an accessor called ``__clause_element__()``. The Core expression system looks for this method when an object of otherwise unknown type is passed to a function that is looking to coerce the argument into a :class:`_expression.ColumnElement` and sometimes a :class:`_expression.SelectBase` expression. It is used within the ORM to convert from ORM-specific objects like mapped classes and mapped attributes into Core expression objects. * The Python ``None`` value is typically interpreted as ``NULL``, which in SQLAlchemy Core produces an instance of :func:`.null`. A :class:`_expression.ColumnElement` provides the ability to generate new :class:`_expression.ColumnElement` objects using Python expressions. This means that Python operators such as ``==``, ``!=`` and ``<`` are overloaded to mimic SQL operations, and allow the instantiation of further :class:`_expression.ColumnElement` instances which are composed from other, more fundamental :class:`_expression.ColumnElement` objects. For example, two :class:`.ColumnClause` objects can be added together with the addition operator ``+`` to produce a :class:`.BinaryExpression`. Both :class:`.ColumnClause` and :class:`.BinaryExpression` are subclasses of :class:`_expression.ColumnElement`: .. sourcecode:: pycon+sql >>> from sqlalchemy.sql import column >>> column('a') + column('b') <sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0> >>> print(column('a') + column('b')) {printsql}a + b .. seealso:: :class:`_schema.Column` :func:`_expression.column`
Method | __getattr__ |
Undocumented |
Method | cast |
Produce a type cast, i.e. ``CAST(<expression> AS <type>)``. |
Method | comparator |
Undocumented |
Method | label |
Produce a column label, i.e. ``<columnname> AS <name>``. |
Method | operate |
Operate on an argument. |
Method | reverse |
Reverse operate on an argument. |
Method | self |
Apply a 'grouping' to this :class:`_expression.ClauseElement`. |
Method | shares |
Return True if the given :class:`_expression.ColumnElement` has a common ancestor to this :class:`_expression.ColumnElement`. |
Class Variable | __visit |
Undocumented |
Class Variable | foreign |
Undocumented |
Class Variable | key |
The 'key' that in some circumstances refers to this object in a Python namespace. |
Class Variable | primary |
Undocumented |
Property | anon |
Undocumented |
Property | anon |
Undocumented |
Property | base |
Undocumented |
Property | expression |
Return a column expression. |
Property | proxy |
set of all columns we are proxying |
Property | type |
Undocumented |
Method | _anon |
Undocumented |
Method | _bind |
Undocumented |
Method | _compare |
Return True if the given column element compares to this one when targeting within a result row. |
Method | _dedupe |
label to apply to a column that is anon labeled, but repeated in the SELECT, so that we have to make an "extra anon" label that disambiguates it from the previous appearance. |
Method | _dedupe |
Undocumented |
Method | _expression |
a suggested label to use in the case that the column has no name, which should be used if possible as the explicit 'AS <label>' where this expression would normally have an anon label. |
Method | _make |
Create a new :class:`_expression.ColumnElement` representing this :class:`_expression.ColumnElement` as it appears in the select list of a descending selectable. |
Method | _negate |
Undocumented |
Method | _proxy |
Undocumented |
Method | _tq |
A label-based version of 'key' that in some circumstances refers to this object in a Python namespace. |
Method | _uncached |
An 'uncached' version of proxy set. |
Class Variable | _allow |
A flag that can be flipped to prevent a column from being resolvable by string label name. |
Class Variable | _alt |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _render |
A flag used by select._columns_plus_names that helps to determine we are actually going to render in terms of "SELECT <col> AS <label>". This flag can be returned as False for some Column objects that want to be rendered as simple "SELECT <col>"; typically columns that don't have any parent table and are named the same as what the label would be in any case. |
Property | _anon |
Provides a constant 'anonymous key label' for this ColumnElement. |
Property | _anon |
Provides a constant 'anonymous label' for this ColumnElement. |
Property | _anon |
Undocumented |
Property | _anon |
Undocumented |
Property | _expanded |
Undocumented |
Property | _key |
legacy; renamed to _tq_key_label |
Property | _label |
legacy; renamed to _tq_label |
Property | _non |
the 'name' that naturally applies this element when rendered in SQL. |
Property | _proxies |
Undocumented |
Property | _select |
Undocumented |
Property | _tq |
The named label that can be used to target this column in a result set in a "table qualified" context. |
Inherited from ColumnArgumentOrKeyRole
:
Class Variable | __slots__ |
Undocumented |
Class Variable | _role |
Undocumented |
Inherited from AllowsLambdaRole
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
):
Class Variable | allows |
Undocumented |
Inherited from UsesInspection
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
):
Class Variable | uses |
Undocumented |
Class Variable | _post |
Undocumented |
Inherited from SQLCoreOperations
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
):
Method | __add__ |
Implement the ``+`` operator. |
Method | __and__ |
Implement the ``&`` operator. |
Method | __contains__ |
Undocumented |
Method | __eq__ |
Implement the ``==`` operator. |
Method | __floordiv__ |
Implement the ``//`` operator. |
Method | __ge__ |
Implement the ``>=`` operator. |
Method | __getitem__ |
Implement the [] operator. |
Method | __gt__ |
Implement the ``>`` operator. |
Method | __invert__ |
Implement the ``~`` operator. |
Method | __le__ |
Implement the ``<=`` operator. |
Method | __lt__ |
Implement the ``<`` operator. |
Method | __mod__ |
Implement the ``%`` operator. |
Method | __mul__ |
Implement the ``*`` operator. |
Method | __ne__ |
Implement the ``!=`` operator. |
Method | __neg__ |
Implement the ``-`` operator. |
Method | __or__ |
Implement the ``|`` operator. |
Method | __radd__ |
Implement the ``+`` operator in reverse. |
Method | __rfloordiv__ |
Implement the ``//`` operator in reverse. |
Method | __rmod__ |
Implement the ``%`` operator in reverse. |
Method | __rmul__ |
Implement the ``*`` operator in reverse. |
Method | __rsub__ |
Implement the ``-`` operator in reverse. |
Method | __rtruediv__ |
Implement the ``/`` operator in reverse. |
Method | __sub__ |
Implement the ``-`` operator. |
Method | __truediv__ |
Implement the ``/`` operator. |
Method | all_ |
Produce an :func:`_expression.all_` clause against the parent object. |
Method | any_ |
Produce an :func:`_expression.any_` clause against the parent object. |
Method | asc |
Produce a :func:`_expression.asc` clause against the parent object. |
Method | between |
Produce a :func:`_expression.between` clause against the parent object, given the lower and upper range. |
Method | bool |
Return a custom boolean operator. |
Method | collate |
Produce a :func:`_expression.collate` clause against the parent object, given the collation string. |
Method | concat |
Implement the 'concat' operator. |
Method | contains |
Implement the 'contains' operator. |
Method | desc |
Produce a :func:`_expression.desc` clause against the parent object. |
Method | distinct |
Produce a :func:`_expression.distinct` clause against the parent object. |
Method | endswith |
Implement the 'endswith' operator. |
Method | ilike |
Implement the ``ilike`` operator, e.g. case insensitive LIKE. |
Method | in_ |
Implement the ``in`` operator. |
Method | is_ |
Implement the ``IS`` operator. |
Method | is |
Implement the ``IS DISTINCT FROM`` operator. |
Method | is |
Implement the ``IS NOT`` operator. |
Method | is |
Implement the ``IS NOT DISTINCT FROM`` operator. |
Method | isnot |
Undocumented |
Method | like |
Implement the ``like`` operator. |
Method | match |
Implements a database-specific 'match' operator. |
Method | not |
implement the ``NOT ILIKE`` operator. |
Method | not |
implement the ``NOT IN`` operator. |
Method | not |
implement the ``NOT LIKE`` operator. |
Method | notilike |
Undocumented |
Method | notin_ |
Undocumented |
Method | notlike |
Undocumented |
Method | nulls |
Produce a :func:`_expression.nulls_first` clause against the parent object. |
Method | nulls |
Produce a :func:`_expression.nulls_last` clause against the parent object. |
Method | nullsfirst |
Undocumented |
Method | nullslast |
Undocumented |
Method | op |
Produce a generic operator function. |
Method | regexp |
Implements a database-specific 'regexp match' operator. |
Method | regexp |
Implements a database-specific 'regexp replace' operator. |
Method | startswith |
Implement the ``startswith`` operator. |
Property | _propagate |
Undocumented |
Inherited from ColumnOperators
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
):
Method | __lshift__ |
implement the << operator. |
Method | __rshift__ |
implement the >> operator. |
Method | bitwise |
Produce a bitwise AND operation, typically via the ``&`` operator. |
Method | bitwise |
Produce a bitwise LSHIFT operation, typically via the ``<<`` operator. |
Method | bitwise |
Produce a bitwise NOT operation, typically via the ``~`` operator. |
Method | bitwise |
Produce a bitwise OR operation, typically via the ``|`` operator. |
Method | bitwise |
Produce a bitwise RSHIFT operation, typically via the ``>>`` operator. |
Method | bitwise |
Produce a bitwise XOR operation, typically via the ``^`` operator, or ``#`` for PostgreSQL. |
Method | icontains |
Implement the ``icontains`` operator, e.g. case insensitive version of :meth:`.ColumnOperators.contains`. |
Method | iendswith |
Implement the ``iendswith`` operator, e.g. case insensitive version of :meth:`.ColumnOperators.endswith`. |
Method | isnot |
Undocumented |
Method | istartswith |
Implement the ``istartswith`` operator, e.g. case insensitive version of :meth:`.ColumnOperators.startswith`. |
Class Variable | timetuple |
Hack, allows datetime objects to be compared on the LHS. |
Method | _rconcat |
Implement an 'rconcat' operator. |
Inherited from DQLDMLClauseElement
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
):
Method | compile |
Compile this SQL expression. |
Method | _compiler |
Return a compiler appropriate for this ClauseElement, given a Dialect. |
Inherited from ClauseElement
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
):
Method | __bool__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | compare |
Compare this :class:`_expression.ClauseElement` to the given :class:`_expression.ClauseElement`. |
Method | get |
Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`. |
Method | params |
Return a copy with :func:`_expression.bindparam` elements replaced. |
Method | unique |
Return a copy with :func:`_expression.bindparam` elements replaced. |
Class Variable | is |
Undocumented |
Class Variable | is |
Undocumented |
Class Variable | is |
Undocumented |
Class Variable | negation |
Undocumented |
Property | description |
Undocumented |
Property | entity |
Undocumented |
Method | _clone |
Create a shallow copy of this ClauseElement. |
Method | _cloned |
Return the set consisting all cloned ancestors of this ClauseElement. |
Method | _compile |
Undocumented |
Method | _execute |
Undocumented |
Method | _execute |
an additional hook for subclasses to provide a different implementation for connection.scalar() vs. connection.execute(). |
Method | _negate |
a hook to allow the right side of a binary expression to respond to a negation of the binary expression. |
Method | _replace |
Undocumented |
Method | _set |
Undocumented |
Method | _ungroup |
Return this :class:`_expression.ClauseElement` without any groupings. |
Method | _with |
in the context of binary expression, convert the type of this object to the one given. |
Class Variable | _cache |
Undocumented |
Class Variable | _gen |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Property | _constructor |
return the 'constructor' for this ClauseElement. |
Property | _from |
Undocumented |
Property | _order |
Undocumented |
Inherited from SupportsWrappingAnnotations
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
):
Method | _annotate |
return a copy of this ClauseElement with annotations updated by the given dictionary. |
Method | _deannotate |
return a copy of this :class:`_expression.ClauseElement` with annotations removed. |
Method | _with |
return a copy of this ClauseElement with annotations replaced by the given dictionary. |
Inherited from SupportsAnnotations
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
):
Method | _gen |
Undocumented |
Property | _annotations |
Undocumented |
Inherited from MemoizedHasCacheKey
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
):
Method | _generate |
return a cache key. |
Inherited from HasCacheKey
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
):
Class Variable | inherit |
Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass. |
Class Method | _generate |
generate cache key dispatcher for a new class. |
Class Method | _generate |
Undocumented |
Method | _gen |
return an optional cache key. |
Class Variable | _generated |
Undocumented |
Class Variable | _hierarchy |
private attribute which may be set to False to prevent the inherit_cache warning from being emitted for a hierarchy of subclasses. |
Class Variable | _is |
Undocumented |
Inherited from HasCopyInternals
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
):
Method | _copy |
Reassign internal elements to be clones of themselves. |
Inherited from HasTraverseInternals
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
, HasCopyInternals
, ExternallyTraversible
):
Class Variable | _traverse |
Undocumented |
Inherited from CompilerElement
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
, HasCopyInternals
, ExternallyTraversible
, HasTraverseInternals
):
Method | __str__ |
Undocumented |
Class Variable | stringify |
Undocumented |
Class Variable | supports |
Undocumented |
Inherited from Visitable
(via ColumnArgumentOrKeyRole
, ColumnArgumentRole
, StatementOptionRole
, WhereHavingRole
, OnClauseRole
, BinaryElementRole
, OrderByRole
, ColumnsClauseRole
, AllowsLambdaRole
, ByOfRole
, UsesInspection
, ColumnListRole
, LimitOffsetRole
, DMLColumnRole
, DDLConstraintColumnRole
, DDLExpressionRole
, StructuralRole
, SQLColumnExpression
, SQLCoreOperations
, ExpressionElementRole
, TypedColumnsClauseRole
, ColumnOperators
, Operators
, SQLRole
, DQLDMLClauseElement
, ClauseElement
, SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
, HasCopyInternals
, ExternallyTraversible
, HasTraverseInternals
, CompilerElement
):
Method | __class |
Undocumented |
Method | __init |
Undocumented |
Class Method | _generate |
Undocumented |
Method | _compiler |
Undocumented |
Class Variable | _original |
Undocumented |
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` .. versionadded:: 1.0.7
Produce a column label, i.e. ``<columnname> AS <name>``. This is a shortcut to the :func:`_expression.label` function. If 'name' is ``None``, an anonymous label name will be generated.
operators.OperatorType
, *other: Any
, **kwargs: Any
) -> ColumnElement[ Any]
:
(source)
¶
sqlalchemy.sql.elements.CollectionAggregate
Operate on an argument. This is the lowest level of operation, raises :class:`NotImplementedError` by default. Overriding this on a subclass can allow common behavior to be applied to all operations. For example, overriding :class:`.ColumnOperators` to apply ``func.lower()`` to the left and right side:: class MyComparator(ColumnOperators): def operate(self, op, other, **kwargs): return op(func.lower(self), func.lower(other), **kwargs) :param op: Operator callable. :param \*other: the 'other' side of the operation. Will be a single scalar for most operations. :param \**kwargs: modifiers. These may be passed by special operators such as :meth:`ColumnOperators.contains`.
operators.OperatorType
, other: Any
, **kwargs: Any
) -> ColumnElement[ Any]
:
(source)
¶
sqlalchemy.sql.elements.CollectionAggregate
Reverse operate on an argument. Usage is the same as :meth:`operate`.
ColumnElement[ _T]
, against: Optional[ OperatorType]
= None) -> ColumnElement[ _T]
:ColumnElement[ Any]
, against: Optional[ OperatorType]
= None) -> ColumnElement[ Any]
:sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.sql.elements.AsBoolean
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.elements.OperatorExpression
, sqlalchemy.sql.elements.Slice
, sqlalchemy.sql.elements.Tuple
, sqlalchemy.sql.elements.TypeCoerce
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.selectable.ScalarSelect
Apply a 'grouping' to this :class:`_expression.ClauseElement`. This method is overridden by subclasses to return a "grouping" construct, i.e. parenthesis. In particular it's used by "binary" expressions to provide a grouping around themselves when placed into a larger expression, as well as by :func:`_expression.select` constructs when placed into the FROM clause of another :func:`_expression.select`. (Note that subqueries should be normally created using the :meth:`_expression.Select.alias` method, as many platforms require nested SELECT statements to be named). As expressions are composed together, the application of :meth:`self_group` is automatic - end-user code should never need to use this method directly. Note that SQLAlchemy's clause constructs take operator precedence into account - so parenthesis might not be needed, for example, in an expression like ``x OR (y AND z)`` - AND takes precedence over OR. The base :meth:`self_group` method of :class:`_expression.ClauseElement` just returns self.
Return True if the given :class:`_expression.ColumnElement` has a common ancestor to this :class:`_expression.ColumnElement`.
sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.sql.elements.BinaryExpression
, sqlalchemy.sql.elements.BindParameter
, sqlalchemy.sql.elements.Case
, sqlalchemy.sql.elements.Cast
, sqlalchemy.sql.elements.CollationClause
, sqlalchemy.sql.elements.ColumnClause
, sqlalchemy.sql.elements.ExpressionClauseList
, sqlalchemy.sql.elements.Extract
, sqlalchemy.sql.elements.False_
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.elements.Null
, sqlalchemy.sql.elements.Over
, sqlalchemy.sql.elements.Slice
, sqlalchemy.sql.elements.TableValuedColumn
, sqlalchemy.sql.elements.True_
, sqlalchemy.sql.elements.Tuple
, sqlalchemy.sql.elements.TypeCoerce
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.elements.WithinGroup
, sqlalchemy.sql.functions.Function
, sqlalchemy.sql.functions.ScalarFunctionColumn
, sqlalchemy.sql.selectable.ScalarValues
, sqlalchemy.sql.elements._label_reference
, sqlalchemy.sql.elements._textual_label_reference
Undocumented
The 'key' that in some circumstances refers to this object in a Python namespace. This typically refers to the "key" of the column as present in the ``.c`` collection of a selectable, e.g. ``sometable.c["somekey"]`` would return a :class:`_schema.Column` with a ``.key`` of "somekey".
sqlalchemy.sql.elements.Label
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.schema.Column
Undocumented
@util.deprecated(
anon_key_label:
str
=
(source)
¶
Undocumented
@util.deprecated(
anon_label:
str
=
(source)
¶
Undocumented
set of all columns we are proxying as of 2.0 this is explicitly deannotated columns. previously it was effectively deannotated columns but wasn't enforced. annotated columns should basically not go into sets if at all possible because their hashing behavior is very non-performant.
sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.sql.elements.AsBoolean
, sqlalchemy.sql.elements.BindParameter
, sqlalchemy.sql.elements.Case
, sqlalchemy.sql.elements.Cast
, sqlalchemy.sql.elements.ColumnClause
, sqlalchemy.sql.elements.Extract
, sqlalchemy.sql.elements.False_
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.elements.Null
, sqlalchemy.sql.elements.OperatorExpression
, sqlalchemy.sql.elements.Over
, sqlalchemy.sql.elements.Slice
, sqlalchemy.sql.elements.TableValuedColumn
, sqlalchemy.sql.elements.True_
, sqlalchemy.sql.elements.Tuple
, sqlalchemy.sql.elements.TypeCoerce
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.elements.WithinGroup
, sqlalchemy.sql.functions.Function
, sqlalchemy.sql.functions.ScalarFunctionColumn
, sqlalchemy.sql.selectable.ScalarSelect
, sqlalchemy.sql.crud._multiparam_column
Undocumented
Optional[ str]
, add_hash: Optional[ int]
= None) -> _anonymous_label
:
(source)
¶
Undocumented
operators.OperatorType
, obj: Any
, type_: Optional[ TypeEngine[ _T]]
= None, expanding: bool
= False) -> BindParameter[ _T]
:
(source)
¶
sqlalchemy.sql.elements.NamedColumn
Return True if the given column element compares to this one when targeting within a result row.
sqlalchemy.sql.elements.WrapsColumnExpression
label to apply to a column that is anon labeled, but repeated in the SELECT, so that we have to make an "extra anon" label that disambiguates it from the previous appearance. these labels come out like "foo_bar_id__1" and have double underscores in them.
a suggested label to use in the case that the column has no name, which should be used if possible as the explicit 'AS <label>' where this expression would normally have an anon label. this is essentially mostly what _proxy_key does except it returns None if the column has a normal name that can be used.
FromClause
, *, name: Optional[ str]
= None, key: Optional[ str]
= None, name_is_truncatable: bool
= False, compound_select_cols: Optional[ Sequence[ ColumnElement[ Any]]]
= None, **kw: Any
) -> typing_Tuple[ str, ColumnClause[ _T]]
:
(source)
¶
sqlalchemy.sql.elements.NamedColumn
Create a new :class:`_expression.ColumnElement` representing this :class:`_expression.ColumnElement` as it appears in the select list of a descending selectable.
sqlalchemy.sql.elements.WrapsColumnExpression
, sqlalchemy.sql.functions.FunctionElement
Undocumented
sqlalchemy.sql.elements.NamedColumn
A label-based version of 'key' that in some circumstances refers to this object in a Python namespace. _tq_key_label comes into play when a select() statement is constructed with apply_labels(); in this case, all Column objects in the ``.c`` collection are rendered as <tablename>_<columnname> in SQL; this is essentially the value of ._label. But to locate those columns in the ``.c`` collection, the name is along the lines of <tablename>_<key>; that's the typical value of .key_label. .. versionchanged:: 1.4.21 renamed from ``._key_label``
An 'uncached' version of proxy set. This list includes annotated columns which perform very poorly in set operations.
sqlalchemy.sql.elements.Label
A flag that can be flipped to prevent a column from being resolvable by string label name. The joined eager loader strategy in the ORM uses this, for example.
sqlalchemy.sql.elements.NamedColumn
A flag used by select._columns_plus_names that helps to determine we are actually going to render in terms of "SELECT <col> AS <label>". This flag can be returned as False for some Column objects that want to be rendered as simple "SELECT <col>"; typically columns that don't have any parent table and are named the same as what the label would be in any case.
Provides a constant 'anonymous key label' for this ColumnElement. Compare to ``anon_label``, except that the "key" of the column, if available, is used to generate the label. This is used when a deduplicating key is placed into the columns collection of a selectable. .. versionchanged:: 1.4.9 - this attribute was not intended to be public and is renamed to _anon_key_label. anon_key_label exists for backwards compat
sqlalchemy.sql.elements.WrapsColumnExpression
Provides a constant 'anonymous label' for this ColumnElement. This is a label() expression which will be named at compile time. The same label() is returned each time ``anon_label`` is called so that expressions can reference ``anon_label`` multiple times, producing the same label name at compile time. The compiler uses this function automatically at compile time for expressions that are known to be 'unnamed' like binary expressions and function calls. .. versionchanged:: 1.4.9 - this attribute was not intended to be public and is renamed to _anon_name_label. anon_name exists for backwards compat
sqlalchemy.sql.elements.NamedColumn
, sqlalchemy.sql.elements.WrapsColumnExpression
, sqlalchemy.sql.functions.FunctionElement
the 'name' that naturally applies this element when rendered in SQL. Concretely, this is the "name" of a column or a label in a SELECT statement; ``<columnname>`` and ``<labelname>`` below:: SELECT <columnmame> FROM table SELECT column AS <labelname> FROM table Above, the two names noted will be what's present in the DBAPI ``cursor.description`` as the names. If this attribute returns ``None``, it means that the SQL element as written does not have a 100% fully predictable "name" that would appear in the ``cursor.description``. Examples include SQL functions, CAST functions, etc. While such things do return names in ``cursor.description``, they are only predictable on a database-specific basis; e.g. an expression like ``MAX(table.col)`` may appear as the string ``max`` on one database (like PostgreSQL) or may appear as the whole expression ``max(table.col)`` on SQLite. The default implementation looks for a ``.name`` attribute on the object, as has been the precedent established in SQLAlchemy for many years. An exception is made on the ``FunctionElement`` subclass so that the return value is always ``None``. .. versionadded:: 1.4.21
sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.schema.Column
Undocumented
sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.NamedColumn
, sqlalchemy.sql.elements.WrapsColumnExpression
The named label that can be used to target this column in a result set in a "table qualified" context. This label is almost always the label used when rendering <expr> AS <label> in a SELECT statement when using the LABEL_STYLE_TABLENAME_PLUS_COL label style, which is what the legacy ORM ``Query`` object uses as well. For a regular Column bound to a Table, this is typically the label <tablename>_<columnname>. For other constructs, different rules may apply, such as anonymized labels and others. .. versionchanged:: 1.4.21 renamed from ``._label``