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

Method excluded

lib/sqlalchemy/dialects/postgresql/dml.py:78–104  ·  view source on GitHub ↗

Provide the ``excluded`` namespace for an ON CONFLICT statement PG's ON CONFLICT clause allows reference to the row that would be inserted, known as ``excluded``. This attribute provides all columns in this row to be referenceable. .. tip:: The :attr:`_postgresql.

(
        self,
    )

Source from the content-addressed store, hash-verified

76
77 @util.memoized_property
78 def excluded(
79 self,
80 ) -> ReadOnlyColumnCollection[str, KeyedColumnElement[Any]]:
81 """Provide the ``excluded`` namespace for an ON CONFLICT statement
82
83 PG's ON CONFLICT clause allows reference to the row that would
84 be inserted, known as ``excluded``. This attribute provides
85 all columns in this row to be referenceable.
86
87 .. tip:: The :attr:`_postgresql.Insert.excluded` attribute is an
88 instance of :class:`_expression.ColumnCollection`, which provides
89 an interface the same as that of the :attr:`_schema.Table.c`
90 collection described at :ref:`metadata_tables_and_columns`.
91 With this collection, ordinary names are accessible like attributes
92 (e.g. ``stmt.excluded.some_column``), but special names and
93 dictionary method names should be accessed using indexed access,
94 such as ``stmt.excluded["column name"]`` or
95 ``stmt.excluded["values"]``. See the docstring for
96 :class:`_expression.ColumnCollection` for further examples.
97
98 .. seealso::
99
100 :ref:`postgresql_insert_on_conflict` - example of how
101 to use :attr:`_expression.Insert.excluded`
102
103 """
104 return alias(self.table, name="excluded").columns
105
106 _on_conflict_exclusive = _exclusive_against(
107 "_post_values_clause",

Callers

nothing calls this directly

Calls 1

aliasFunction · 0.85

Tested by

no test coverage detected