class ClauseElement(SupportsWrappingAnnotations, MemoizedHasCacheKey, HasCopyInternals, ExternallyTraversible, CompilerElement): (source)
Known subclasses: sqlalchemy.dialects.mysql.dml.OnDuplicateClause
, sqlalchemy.dialects.postgresql.dml.OnConflictClause
, sqlalchemy.dialects.sqlite.dml.OnConflictClause
, sqlalchemy.sql.ddl.BaseDDLElement
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.elements.DQLDMLClauseElement
, sqlalchemy.sql.lambdas.LambdaElement
, sqlalchemy.sql.lambdas.NullLambdaStatement
, sqlalchemy.sql.selectable.ForUpdateArg
, sqlalchemy.sql.elements._IdentifiedClause
Base class for elements of a programmatically constructed SQL expression.
Method | __bool__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __invert__ |
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 | self |
Apply a 'grouping' to this :class:`_expression.ClauseElement`. |
Method | unique |
Return a copy with :func:`_expression.bindparam` elements replaced. |
Class Variable | __visit |
Undocumented |
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 |
Undocumented |
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 |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Instance Variable | _propagate |
like annotations, however these propagate outwards liberally as SQL constructs are built, and are set up at construction time. |
Property | _constructor |
return the 'constructor' for this ClauseElement. |
Property | _from |
Undocumented |
Property | _order |
Undocumented |
Inherited from SupportsWrappingAnnotations
:
Class Variable | __slots__ |
Undocumented |
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 SupportsWrappingAnnotations
):
Class Variable | proxy |
Undocumented |
Method | _gen |
Undocumented |
Property | _annotations |
Undocumented |
Inherited from MemoizedHasCacheKey
(via SupportsWrappingAnnotations
, SupportsAnnotations
):
Method | _generate |
return a cache key. |
Inherited from HasCacheKey
(via 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 SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
):
Method | _copy |
Reassign internal elements to be clones of themselves. |
Inherited from HasTraverseInternals
(via SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
, HasCopyInternals
, ExternallyTraversible
):
Class Variable | _traverse |
Undocumented |
Inherited from CompilerElement
(via SupportsWrappingAnnotations
, SupportsAnnotations
, MemoizedHasCacheKey
, HasCacheKey
, HasCopyInternals
, ExternallyTraversible
, HasTraverseInternals
):
Method | __str__ |
Undocumented |
Method | compile |
Compile this SQL expression. |
Class Variable | stringify |
Undocumented |
Class Variable | supports |
Undocumented |
Method | _compiler |
Return a compiler appropriate for this ClauseElement, given a Dialect. |
Inherited from Visitable
(via 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 |
sqlalchemy.sql.functions.next_value
, sqlalchemy.sql.functions.next_value
, sqlalchemy.sql.crud._multiparam_column
Compare this :class:`_expression.ClauseElement` to the given :class:`_expression.ClauseElement`. Subclasses should override the default behavior, which is a straight identity comparison. \**kw are arguments consumed by subclass ``compare()`` methods and may be used to modify the criteria for comparison (see :class:`_expression.ColumnElement`).
typing_Tuple[ str, ...]
= ..., **kw: Any
) -> Iterable[ ClauseElement]
:
(source)
¶
sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.orm.context.FromStatement
, sqlalchemy.orm.context.FromStatement
, sqlalchemy.sql.elements.ColumnClause
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`. This is used for visit traversal. \**kw may contain flags that change the collection that is returned, for example to return a subset of items in order to cut down on larger traversals, or to return child items from a different context (such as schema-level collections instead of clause-level).
Optional[ Mapping[ str, Any]]
= None, **kwargs: Any
) -> Self
:
(source)
¶
sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
Return a copy with :func:`_expression.bindparam` elements replaced. Returns a copy of this ClauseElement with :func:`_expression.bindparam` elements replaced with values taken from the given dictionary:: >>> clause = column('x') + bindparam('foo') >>> print(clause.compile().params) {'foo':None} >>> print(clause.params({'foo':7}).compile().params) {'foo':7}
sqlalchemy.sql.elements.ClauseList
, sqlalchemy.sql.elements.ColumnElement
, sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.elements.TextClause
, sqlalchemy.sql.selectable.CompoundSelect
, sqlalchemy.sql.selectable.CompoundSelect
, sqlalchemy.sql.selectable.CompoundSelect
, sqlalchemy.sql.selectable.FromClause
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
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.
Optional[ Dict[ str, Any]]
= None, **kwargs: Any
) -> Self
:
(source)
¶
Return a copy with :func:`_expression.bindparam` elements replaced. Same functionality as :meth:`_expression.ClauseElement.params`, except adds `unique=True` to affected bind parameters so that multiple statements can be used.
sqlalchemy.dialects.mysql.dml.OnDuplicateClause
, sqlalchemy.dialects.postgresql.CreateDomainType
, sqlalchemy.dialects.postgresql.CreateEnumType
, sqlalchemy.dialects.postgresql.dml.OnConflictDoNothing
, sqlalchemy.dialects.postgresql.dml.OnConflictDoUpdate
, sqlalchemy.dialects.postgresql.DropDomainType
, sqlalchemy.dialects.postgresql.DropEnumType
, sqlalchemy.dialects.sqlite.dml.OnConflictDoNothing
, sqlalchemy.dialects.sqlite.dml.OnConflictDoUpdate
, sqlalchemy.orm.context.FromStatement
, sqlalchemy.sql.ddl.AddConstraint
, sqlalchemy.sql.ddl.CreateColumn
, sqlalchemy.sql.ddl.CreateIndex
, sqlalchemy.sql.ddl.CreateSchema
, sqlalchemy.sql.ddl.CreateSequence
, sqlalchemy.sql.ddl.CreateTable
, sqlalchemy.sql.ddl.DDL
, sqlalchemy.sql.ddl.DropColumnComment
, sqlalchemy.sql.ddl.DropConstraint
, sqlalchemy.sql.ddl.DropConstraintComment
, sqlalchemy.sql.ddl.DropIndex
, sqlalchemy.sql.ddl.DropSchema
, sqlalchemy.sql.ddl.DropSequence
, sqlalchemy.sql.ddl.DropTable
, sqlalchemy.sql.ddl.DropTableComment
, sqlalchemy.sql.ddl.SetColumnComment
, sqlalchemy.sql.ddl.SetConstraintComment
, sqlalchemy.sql.ddl.SetTableComment
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.elements.ClauseList
, sqlalchemy.sql.elements.ColumnElement
, sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.elements.TextClause
, sqlalchemy.sql.elements.TypeClause
, sqlalchemy.sql.lambdas.LambdaElement
, sqlalchemy.sql.lambdas.NullLambdaStatement
, sqlalchemy.sql.selectable.CompoundSelect
, sqlalchemy.sql.selectable.CompoundSelect
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Selectable
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.TextualSelect
, sqlalchemy.sql.selectable.TextualSelect
, sqlalchemy.sql.ddl._DropView
, sqlalchemy.sql.elements._IdentifiedClause
Undocumented
Create a shallow copy of this ClauseElement. This method may be used by a generative API. Its also used as part of the "deep" copy afforded by a traversal that combines the _copy_internals() method.
Return the set consisting all cloned ancestors of this ClauseElement. Includes this ClauseElement. This accessor tends to be used for FromClause objects to identify 'equivalent' FROM clauses, regardless of transformative operations.
Dialect
, *, compiled_cache: Optional[ CompiledCacheType]
, column_keys: List[ str]
, for_executemany: bool
= False, schema_translate_map: Optional[ SchemaTranslateMapType]
= None, **kw: Any
) -> typing_Tuple[ Compiled, Optional[ Sequence[ BindParameter[ Any]]], CacheStats]
:
(source)
¶
sqlalchemy.sql.ddl.BaseDDLElement
Undocumented
Connection
, distilled_params: _CoreMultiExecuteParams
, execution_options: CoreExecuteOptionsParameter
) -> Result[ Any]
:
(source)
¶
Connection
, distilled_params: _CoreMultiExecuteParams
, execution_options: CoreExecuteOptionsParameter
) -> Any
:
(source)
¶
an additional hook for subclasses to provide a different implementation for connection.scalar() vs. connection.execute(). .. versionadded:: 2.0
sqlalchemy.sql.elements.BindParameter
a hook to allow the right side of a binary expression to respond to a negation of the binary expression. Used for the special case of expanding bind parameter with IN.
bool
, optionaldict: Optional[ Mapping[ str, Any]]
, kwargs: Dict[ str, Any]
) -> Self
:
(source)
¶
Undocumented
sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.selectable.ScalarSelect
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
Return this :class:`_expression.ClauseElement` without any groupings.
sqlalchemy.sql.elements.BindParameter
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Grouping
in the context of binary expression, convert the type of this object to the one given. applies only to :class:`_expression.ColumnElement` classes.
sqlalchemy.orm.context.FromStatement
, sqlalchemy.orm.context.FromStatement
, sqlalchemy.sql.elements.BinaryExpression
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
, sqlalchemy.sql.selectable.Select
Undocumented
sqlalchemy.sql.elements.BinaryExpression
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.lambdas.LinkedLambdaElement
, sqlalchemy.sql.lambdas.NullLambdaStatement
like annotations, however these propagate outwards liberally as SQL constructs are built, and are set up at construction time.
return the 'constructor' for this ClauseElement. This is for the purposes for creating a new object of this type. Usually, its just the element's __class__. However, the "Annotated" version of the object overrides to return the class of its proxied element.
sqlalchemy.dialects.postgresql.aggregate_order_by
, sqlalchemy.sql.elements.BinaryExpression
, sqlalchemy.sql.elements.Case
, sqlalchemy.sql.elements.Cast
, sqlalchemy.sql.elements.ClauseList
, sqlalchemy.sql.elements.ColumnClause
, sqlalchemy.sql.elements.ExpressionClauseList
, sqlalchemy.sql.elements.Extract
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.elements.Over
, sqlalchemy.sql.elements.TableValuedColumn
, sqlalchemy.sql.elements.TypeCoerce
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.elements.WithinGroup
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.lambdas.LambdaElement
, sqlalchemy.sql.selectable.AliasedReturnsRows
, sqlalchemy.sql.selectable.FromGrouping
, sqlalchemy.sql.selectable.FromGrouping
, sqlalchemy.sql.selectable.Join
, sqlalchemy.sql.selectable.ScalarSelect
, sqlalchemy.sql.selectable.ScalarSelect
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.TableClause
, sqlalchemy.sql.selectable.Values
, sqlalchemy.sql.elements._label_reference
Undocumented