MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / selected_columns

Method selected_columns

lib/sqlalchemy/sql/selectable.py:7410–7435  ·  view source on GitHub ↗

A :class:`_expression.ColumnCollection` representing the columns that this SELECT statement or similar construct returns in its result set, not including :class:`_sql.TextClause` constructs. This collection differs from the :attr:`_expression.FromClause.columns`

(
        self,
    )

Source from the content-addressed store, hash-verified

7408
7409 @HasMemoized_ro_memoized_attribute
7410 def selected_columns(
7411 self,
7412 ) -> ColumnCollection[str, KeyedColumnElement[Any]]:
7413 """A :class:`_expression.ColumnCollection`
7414 representing the columns that
7415 this SELECT statement or similar construct returns in its result set,
7416 not including :class:`_sql.TextClause` constructs.
7417
7418 This collection differs from the :attr:`_expression.FromClause.columns`
7419 collection of a :class:`_expression.FromClause` in that the columns
7420 within this collection cannot be directly nested inside another SELECT
7421 statement; a subquery must be applied first which provides for the
7422 necessary parenthesization required by SQL.
7423
7424 For a :class:`_expression.TextualSelect` construct, the collection
7425 contains the :class:`_expression.ColumnElement` objects that were
7426 passed to the constructor, typically via the
7427 :meth:`_expression.TextClause.columns` method.
7428
7429
7430 .. versionadded:: 1.4
7431
7432 """
7433 return WriteableColumnCollection(
7434 (c.key, c) for c in self.column_args
7435 ).as_readonly()
7436
7437 @util.ro_non_memoized_property
7438 def _all_selected_columns(self) -> _SelectIterable:

Callers

nothing calls this directly

Calls 2

as_readonlyMethod · 0.45

Tested by

no test coverage detected