Return a new construct with the given expression(s) added to its WHERE clause, joined to the existing clause via AND, if any. Both :meth:`_dml.Update.where` and :meth:`_dml.Delete.where` support multiple-table forms, including database-specific ``UPDATE...FROM`` as w
(self, *whereclause: _ColumnExpressionArgument[bool])
| 1526 | |
| 1527 | @_generative |
| 1528 | def where(self, *whereclause: _ColumnExpressionArgument[bool]) -> Self: |
| 1529 | """Return a new construct with the given expression(s) added to |
| 1530 | its WHERE clause, joined to the existing clause via AND, if any. |
| 1531 | |
| 1532 | Both :meth:`_dml.Update.where` and :meth:`_dml.Delete.where` |
| 1533 | support multiple-table forms, including database-specific |
| 1534 | ``UPDATE...FROM`` as well as ``DELETE..USING``. For backends that |
| 1535 | don't have multiple-table support, a backend agnostic approach |
| 1536 | to using multiple tables is to make use of correlated subqueries. |
| 1537 | See the linked tutorial sections below for examples. |
| 1538 | |
| 1539 | .. seealso:: |
| 1540 | |
| 1541 | :ref:`tutorial_correlated_updates` |
| 1542 | |
| 1543 | :ref:`tutorial_update_from` |
| 1544 | |
| 1545 | :ref:`tutorial_multi_table_deletes` |
| 1546 | |
| 1547 | """ |
| 1548 | |
| 1549 | for criterion in whereclause: |
| 1550 | where_criteria: ColumnElement[Any] = coercions.expect( |
| 1551 | roles.WhereHavingRole, criterion, apply_propagate_attrs=self |
| 1552 | ) |
| 1553 | self._where_criteria += (where_criteria,) |
| 1554 | return self |
| 1555 | |
| 1556 | def filter(self, *criteria: roles.ExpressionElementRole[Any]) -> Self: |
| 1557 | """A synonym for the :meth:`.where` method. |