Represents a column expression from any textual string. The :class:`.ColumnClause`, a lightweight analogue to the :class:`_schema.Column` class, is typically invoked using the :func:`_expression.column` function, as in:: from sqlalchemy import column id, name = column(
| 5340 | |
| 5341 | |
| 5342 | class ColumnClause( |
| 5343 | roles.DDLReferredColumnRole, |
| 5344 | roles.LabeledColumnExprRole[_T], |
| 5345 | roles.StrAsPlainColumnRole, |
| 5346 | Immutable, |
| 5347 | NamedColumn[_T], |
| 5348 | ): |
| 5349 | """Represents a column expression from any textual string. |
| 5350 | |
| 5351 | The :class:`.ColumnClause`, a lightweight analogue to the |
| 5352 | :class:`_schema.Column` class, is typically invoked using the |
| 5353 | :func:`_expression.column` function, as in:: |
| 5354 | |
| 5355 | from sqlalchemy import column |
| 5356 | |
| 5357 | id, name = column("id"), column("name") |
| 5358 | stmt = select(id, name).select_from("user") |
| 5359 | |
| 5360 | The above statement would produce SQL like: |
| 5361 | |
| 5362 | .. sourcecode:: sql |
| 5363 | |
| 5364 | SELECT id, name FROM user |
| 5365 | |
| 5366 | :class:`.ColumnClause` is the immediate superclass of the schema-specific |
| 5367 | :class:`_schema.Column` object. While the :class:`_schema.Column` |
| 5368 | class has all the |
| 5369 | same capabilities as :class:`.ColumnClause`, the :class:`.ColumnClause` |
| 5370 | class is usable by itself in those cases where behavioral requirements |
| 5371 | are limited to simple SQL expression generation. The object has none of |
| 5372 | the associations with schema-level metadata or with execution-time |
| 5373 | behavior that :class:`_schema.Column` does, |
| 5374 | so in that sense is a "lightweight" |
| 5375 | version of :class:`_schema.Column`. |
| 5376 | |
| 5377 | Full details on :class:`.ColumnClause` usage is at |
| 5378 | :func:`_expression.column`. |
| 5379 | |
| 5380 | .. seealso:: |
| 5381 | |
| 5382 | :func:`_expression.column` |
| 5383 | |
| 5384 | :class:`_schema.Column` |
| 5385 | |
| 5386 | """ |
| 5387 | |
| 5388 | table: Optional[FromClause] |
| 5389 | is_literal: bool |
| 5390 | |
| 5391 | __visit_name__ = "column" |
| 5392 | |
| 5393 | _traverse_internals: _TraverseInternalsType = [ |
| 5394 | ("name", InternalTraversal.dp_anon_name), |
| 5395 | ("type", InternalTraversal.dp_type), |
| 5396 | ("table", InternalTraversal.dp_clauseelement), |
| 5397 | ("is_literal", InternalTraversal.dp_boolean), |
| 5398 | ] |
| 5399 |
no outgoing calls
no test coverage detected