MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / returning_column_descriptions

Method returning_column_descriptions

lib/sqlalchemy/sql/dml.py:960–1004  ·  view source on GitHub ↗

Return a :term:`plugin-enabled` description of the columns which this DML construct is RETURNING against, in other words the expressions established as part of :meth:`.UpdateBase.returning`. This attribute is generally useful when using the ORM, as an extended struct

(self)

Source from the content-addressed store, hash-verified

958
959 @property
960 def returning_column_descriptions(self) -> List[Dict[str, Any]]:
961 """Return a :term:`plugin-enabled` description of the columns
962 which this DML construct is RETURNING against, in other words
963 the expressions established as part of :meth:`.UpdateBase.returning`.
964
965 This attribute is generally useful when using the ORM, as an
966 extended structure which includes information about mapped
967 entities is returned. The section :ref:`queryguide_inspection`
968 contains more background.
969
970 For a Core statement, the structure returned by this accessor is
971 derived from the same objects that are returned by the
972 :attr:`.UpdateBase.exported_columns` accessor::
973
974 >>> stmt = insert(user_table).returning(user_table.c.id, user_table.c.name)
975 >>> stmt.entity_description
976 [
977 {
978 "name": "id",
979 "type": Integer,
980 "expr": Column("id", Integer(), table=<user>, ...)
981 },
982 {
983 "name": "name",
984 "type": String(),
985 "expr": Column("name", String(), table=<user>, ...)
986 },
987 ]
988
989 .. versionadded:: 1.4.33
990
991 .. seealso::
992
993 :attr:`.UpdateBase.entity_description`
994
995 :attr:`.Select.column_descriptions` - entity information for
996 a :func:`.select` construct
997
998 :ref:`queryguide_inspection` - ORM background
999
1000 """ # noqa: E501
1001 meth = DMLState.get_plugin_class(
1002 self
1003 ).get_returning_column_descriptions
1004 return meth(self)
1005
1006
1007class ValuesBase(UpdateBase):

Callers

nothing calls this directly

Calls 1

get_plugin_classMethod · 0.45

Tested by

no test coverage detected