class ClauseElement(roles.SQLRole, SupportsWrappingAnnotations, MemoizedHasCacheKey, HasCopyInternals, Traversible):
Known subclasses: sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.elements.ClauseList
, sqlalchemy.sql.elements.TextClause
, sqlalchemy.sql.expression.ColumnElement
, sqlalchemy.sql.expression.LambdaElement
, sqlalchemy.sql.selectable.ReturnsRows
, sqlalchemy.databases.oracle._OuterJoinColumn
, sqlalchemy.sql.ddl._DDLCompiles
, sqlalchemy.sql.elements._IdentifiedClause
, sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.elements.TypeClause
, sqlalchemy.sql.lambdas.NullLambdaStatement
, sqlalchemy.sql.selectable.ForUpdateArg
Method | compare |
Compare this _expression.ClauseElement to the given _expression.ClauseElement . |
Method | compile |
Compile this SQL expression. |
Method | params |
Return a copy with _expression.bindparam elements replaced. |
Method | self_group |
Apply a 'grouping' to this _expression.ClauseElement . |
Method | unique_params |
Return a copy with _expression.bindparam elements replaced. |
Method | __bool__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __invert__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | _clone |
Create a shallow copy of this ClauseElement. |
Method | _cloned_set |
Return the set consisting all cloned ancestors of this ClauseElement. |
Method | _compile_w_cache |
Undocumented |
Method | _compiler |
Return a compiler appropriate for this ClauseElement, given a Dialect. |
Method | _execute_on_connection |
Undocumented |
Method | _negate |
Undocumented |
Method | _negate_in_binary |
a hook to allow the right side of a binary expression to respond to a negation of the binary expression. |
Method | _replace_params |
Undocumented |
Method | _set_propagate_attrs |
Undocumented |
Method | _ungroup |
Return this _expression.ClauseElement without any groupings. |
Method | _with_binary_element_type |
in the context of binary expression, convert the type of this object to the one given. |
Class Variable | __visit_name__ |
Undocumented |
Class Variable | _cache_key_traversal |
Undocumented |
Class Variable | _from_objects |
Undocumented |
Class Variable | _is_bind_parameter |
Undocumented |
Class Variable | _is_clause_list |
Undocumented |
Class Variable | _is_clone_of |
Undocumented |
Class Variable | _is_from_clause |
Undocumented |
Class Variable | _is_from_container |
Undocumented |
Class Variable | _is_immutable |
Undocumented |
Class Variable | _is_lambda_element |
Undocumented |
Class Variable | _is_returns_rows |
Undocumented |
Class Variable | _is_select_container |
Undocumented |
Class Variable | _is_select_statement |
Undocumented |
Class Variable | _is_singleton_constant |
Undocumented |
Class Variable | _is_text_clause |
Undocumented |
Class Variable | _is_textual |
Undocumented |
Class Variable | _order_by_label_element |
Undocumented |
Class Variable | bind |
Undocumented |
Class Variable | description |
Undocumented |
Class Variable | is_clause_element |
Undocumented |
Class Variable | is_selectable |
Undocumented |
Class Variable | stringify_dialect |
Undocumented |
Class Variable | supports_execution |
Undocumented |
Instance Variable | _propagate_attrs |
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 | entity_namespace |
Undocumented |
Inherited from SQLRole
:
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from SupportsWrappingAnnotations
:
Method | _annotate |
return a copy of this ClauseElement with annotations updated by the given dictionary. |
Method | _deannotate |
return a copy of this _expression.ClauseElement with annotations removed. |
Method | _with_annotations |
return a copy of this ClauseElement with annotations replaced by the given dictionary. |
Inherited from SupportsAnnotations
(via SupportsWrappingAnnotations
):
Property | _annotations_cache_key |
Undocumented |
Inherited from MemoizedHasCacheKey
:
Method | _generate_cache_key |
return a cache key. |
Inherited from HasCacheKey
(via MemoizedHasCacheKey
):
Class Variable | inherit_cache |
Indicate if this .HasCacheKey instance should make use of the cache key generation scheme used by its immediate superclass. |
Class Method | _generate_cache_attrs |
generate cache key dispatcher for a new class. |
Class Method | _generate_cache_key_for_object |
Undocumented |
Method | _gen_cache_key |
return an optional cache key. |
Class Variable | __slots__ |
Undocumented |
Class Variable | _hierarchy_supports_caching |
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_has_cache_key |
Undocumented |
Inherited from HasCopyInternals
:
Method | _copy_internals |
Reassign internal elements to be clones of themselves. |
Inherited from Traversible
:
Method | get_children |
Return immediate child .visitors.Traversible elements of this .visitors.Traversible . |
Method | __class_getitem__ |
Undocumented |
sqlalchemy.sql.crud._multiparam_column
Compare this _expression.ClauseElement
to
the given _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 _expression.ColumnElement
).
Compile this SQL expression.
The return value is a ~.Compiled
object.
Calling str() or unicode() on the returned value will yield a
string representation of the result. The
~.Compiled
object also can return a
dictionary of bind parameter names and values
using the params accessor.
See Also
Parameters | |
bind | An Engine or Connection from which a
Compiled will be acquired. This argument takes precedence over
this _expression.ClauseElement 's bound engine, if any. |
dialect | A Dialect instance from which a Compiled
will be acquired. This argument takes precedence over the bind
argument as well as this _expression.ClauseElement
's bound engine,
if any. |
**kw | Undocumented |
column_keys | Used for INSERT and UPDATE statements, a list of column names which should be present in the VALUES clause of the compiled statement. If None, all columns from the target table object are rendered. |
compile_kwargs | optional dictionary of additional parameters that will be passed through to the compiler within all "visit" methods. This allows any custom flag to be passed through to a custom compilation construct, for example. It is also used for the case of passing the literal_binds flag through: from sqlalchemy.sql import table, column, select t = table('t', column('x')) s = select(t).where(t.c.x == 5) print(s.compile(compile_kwargs={"literal_binds": True}))
New in version 0.9.0.
|
sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
Return a copy with _expression.bindparam
elements
replaced.
Returns a copy of this ClauseElement with
_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.TextClause
, sqlalchemy.sql.expression.ColumnElement
, sqlalchemy.sql.expression.CompoundSelect
, sqlalchemy.sql.expression.Join
, sqlalchemy.sql.expression.Select
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.selectable.SelectStatementGrouping
Apply a 'grouping' to this _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 _expression.select
constructs when placed into the FROM clause of another
_expression.select
. (Note that subqueries should be
normally created using the _expression.Select.alias
method,
as many
platforms require nested SELECT statements to be named).
As expressions are composed together, the application of
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 self_group
method of
_expression.ClauseElement
just returns self.
Return a copy with _expression.bindparam
elements
replaced.
Same functionality as _expression.ClauseElement.params
,
except adds unique=True
to affected bind parameters so that multiple statements can be
used.
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.
sqlalchemy.sql.ddl._DDLCompiles
Undocumented
sqlalchemy.sql.ddl._DDLCompiles
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.
sqlalchemy.sql.elements.GroupedElement
_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 _expression.ColumnElement
classes.
str
=
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.DropConstraint
, sqlalchemy.sql.ddl.DropIndex
, sqlalchemy.sql.ddl.DropSchema
, sqlalchemy.sql.ddl.DropSequence
, sqlalchemy.sql.ddl.DropTable
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.elements.ClauseList
, sqlalchemy.sql.elements.TextClause
, sqlalchemy.sql.expression.ColumnElement
, sqlalchemy.sql.expression.LambdaElement
, sqlalchemy.sql.expression.Selectable
, sqlalchemy.databases.oracle._OuterJoinColumn
, sqlalchemy.dialects.postgresql.CreateEnumType
, sqlalchemy.dialects.postgresql.DropEnumType
, sqlalchemy.sql.ddl._DropView
, sqlalchemy.sql.ddl.DropColumnComment
, sqlalchemy.sql.ddl.DropTableComment
, sqlalchemy.sql.ddl.SetColumnComment
, sqlalchemy.sql.ddl.SetTableComment
, sqlalchemy.sql.elements._IdentifiedClause
, sqlalchemy.sql.elements.GroupedElement
, sqlalchemy.sql.elements.TypeClause
, sqlalchemy.sql.lambdas.NullLambdaStatement
Undocumented
list
=
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.Extract
, sqlalchemy.sql.elements.FunctionFilter
, sqlalchemy.sql.elements.Label
, sqlalchemy.sql.elements.Over
, sqlalchemy.sql.elements.TypeCoerce
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.elements.WithinGroup
, sqlalchemy.sql.expression.AliasedReturnsRows
, sqlalchemy.sql.expression.Join
, sqlalchemy.sql.expression.LambdaElement
, sqlalchemy.sql.expression.TableClause
, sqlalchemy.sql.expression.Values
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.selectable.SelectBase
, sqlalchemy.sql.elements._label_reference
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.Grouping
, sqlalchemy.sql.elements.TableValuedColumn
, sqlalchemy.sql.selectable.FromGrouping
, sqlalchemy.sql.selectable.FromGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
Undocumented
bool
=
sqlalchemy.sql.selectable.SelectStatementGrouping
, sqlalchemy.sql.selectable.SelectStatementGrouping
Undocumented
sqlalchemy.sql.ddl.DDLElement
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.expression.AliasedReturnsRows
, sqlalchemy.sql.expression.CompoundSelect
, sqlalchemy.sql.expression.Join
, sqlalchemy.sql.expression.Select
, sqlalchemy.sql.schema.Table
Undocumented
sqlalchemy.sql.elements.BinaryExpression
, sqlalchemy.sql.elements.UnaryExpression
, sqlalchemy.sql.lambdas.LinkedLambdaElement
, sqlalchemy.sql.lambdas.NullLambdaStatement
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.