r""" Specifies a DO UPDATE SET action for ON CONFLICT clause. :param index_elements: A sequence consisting of string column names, :class:`_schema.Column` objects, or other column expression objects that will be used to infer a target index or unique const
(
self,
index_elements: _OnConflictIndexElementsT = None,
index_where: _OnConflictIndexWhereT = None,
set_: _OnConflictSetT = None,
where: _OnConflictWhereT = None,
)
| 112 | |
| 113 | @_on_conflict_exclusive |
| 114 | def on_conflict_do_update( |
| 115 | self, |
| 116 | index_elements: _OnConflictIndexElementsT = None, |
| 117 | index_where: _OnConflictIndexWhereT = None, |
| 118 | set_: _OnConflictSetT = None, |
| 119 | where: _OnConflictWhereT = None, |
| 120 | ) -> Self: |
| 121 | r""" |
| 122 | Specifies a DO UPDATE SET action for ON CONFLICT clause. |
| 123 | |
| 124 | :param index_elements: |
| 125 | A sequence consisting of string column names, :class:`_schema.Column` |
| 126 | objects, or other column expression objects that will be used |
| 127 | to infer a target index or unique constraint. |
| 128 | |
| 129 | :param index_where: |
| 130 | Additional WHERE criterion that can be used to infer a |
| 131 | conditional target index. |
| 132 | |
| 133 | :param set\_: |
| 134 | A dictionary or other mapping object |
| 135 | where the keys are either names of columns in the target table, |
| 136 | or :class:`_schema.Column` objects or other ORM-mapped columns |
| 137 | matching that of the target table, and expressions or literals |
| 138 | as values, specifying the ``SET`` actions to take. |
| 139 | |
| 140 | .. versionadded:: 1.4 The |
| 141 | :paramref:`_sqlite.Insert.on_conflict_do_update.set_` |
| 142 | parameter supports :class:`_schema.Column` objects from the target |
| 143 | :class:`_schema.Table` as keys. |
| 144 | |
| 145 | .. warning:: This dictionary does **not** take into account |
| 146 | Python-specified default UPDATE values or generation functions, |
| 147 | e.g. those specified using :paramref:`_schema.Column.onupdate`. |
| 148 | These values will not be exercised for an ON CONFLICT style of |
| 149 | UPDATE, unless they are manually specified in the |
| 150 | :paramref:`.Insert.on_conflict_do_update.set_` dictionary. |
| 151 | |
| 152 | :param where: |
| 153 | Optional argument. An expression object representing a ``WHERE`` |
| 154 | clause that restricts the rows affected by ``DO UPDATE SET``. Rows not |
| 155 | meeting the ``WHERE`` condition will not be updated (effectively a |
| 156 | ``DO NOTHING`` for those rows). |
| 157 | |
| 158 | """ |
| 159 | |
| 160 | return self.ext( |
| 161 | OnConflictDoUpdate(index_elements, index_where, set_, where) |
| 162 | ) |
| 163 | |
| 164 | @_on_conflict_exclusive |
| 165 | def on_conflict_do_nothing( |