MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / column_descriptions

Method column_descriptions

lib/sqlalchemy/sql/selectable.py:5712–5753  ·  view source on GitHub ↗

Return a :term:`plugin-enabled` 'column descriptions' structure referring to the columns which are SELECTed by this statement. This attribute is generally useful when using the ORM, as an extended structure which includes information about mapped entities is returned

(self)

Source from the content-addressed store, hash-verified

5710
5711 @property
5712 def column_descriptions(self) -> Any:
5713 """Return a :term:`plugin-enabled` 'column descriptions' structure
5714 referring to the columns which are SELECTed by this statement.
5715
5716 This attribute is generally useful when using the ORM, as an
5717 extended structure which includes information about mapped
5718 entities is returned. The section :ref:`queryguide_inspection`
5719 contains more background.
5720
5721 For a Core-only statement, the structure returned by this accessor
5722 is derived from the same objects that are returned by the
5723 :attr:`.Select.selected_columns` accessor, formatted as a list of
5724 dictionaries which contain the keys ``name``, ``type`` and ``expr``,
5725 which indicate the column expressions to be selected::
5726
5727 >>> stmt = select(user_table)
5728 >>> stmt.column_descriptions
5729 [
5730 {
5731 'name': 'id',
5732 'type': Integer(),
5733 'expr': Column('id', Integer(), ...)},
5734 {
5735 'name': 'name',
5736 'type': String(length=30),
5737 'expr': Column('name', String(length=30), ...)}
5738 ]
5739
5740 .. versionchanged:: 1.4.33 The :attr:`.Select.column_descriptions`
5741 attribute returns a structure for a Core-only set of entities,
5742 not just ORM-only entities.
5743
5744 .. seealso::
5745
5746 :attr:`.UpdateBase.entity_description` - entity information for
5747 an :func:`.insert`, :func:`.update`, or :func:`.delete`
5748
5749 :ref:`queryguide_inspection` - ORM background
5750
5751 """
5752 meth = SelectState.get_plugin_class(self).get_column_descriptions
5753 return meth(self)
5754
5755 def from_statement(
5756 self, statement: roles.ReturnsRowsRole

Callers

nothing calls this directly

Calls 1

get_plugin_classMethod · 0.45

Tested by

no test coverage detected