MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / ordered_values

Method ordered_values

lib/sqlalchemy/sql/dml.py:1680–1710  ·  view source on GitHub ↗

Specify the VALUES clause of this UPDATE statement with an explicit parameter ordering that will be maintained in the SET clause of the resulting UPDATE statement. E.g.:: stmt = table.update().ordered_values(("name", "ed"), ("ident", "foo")) .. seealso:

(self, *args: Tuple[_DMLColumnArgument, Any])

Source from the content-addressed store, hash-verified

1678 super().__init__(table)
1679
1680 def ordered_values(self, *args: Tuple[_DMLColumnArgument, Any]) -> Self:
1681 """Specify the VALUES clause of this UPDATE statement with an explicit
1682 parameter ordering that will be maintained in the SET clause of the
1683 resulting UPDATE statement.
1684
1685 E.g.::
1686
1687 stmt = table.update().ordered_values(("name", "ed"), ("ident", "foo"))
1688
1689 .. seealso::
1690
1691 :ref:`tutorial_parameter_ordered_updates` - full example of the
1692 :meth:`_expression.Update.ordered_values` method.
1693
1694 .. versionchanged:: 1.4 The :meth:`_expression.Update.ordered_values`
1695 method
1696 supersedes the
1697 :paramref:`_expression.update.preserve_parameter_order`
1698 parameter, which will be removed in SQLAlchemy 2.0.
1699
1700 """ # noqa: E501
1701 if self._values:
1702 raise exc.ArgumentError(
1703 "This statement already has "
1704 f"{'ordered ' if self._maintain_values_ordering else ''}"
1705 "values present"
1706 )
1707
1708 self = self.values(dict(args))
1709 self._maintain_values_ordering = True
1710 return self
1711
1712 @_generative
1713 def inline(self) -> Self:

Calls 1

valuesMethod · 0.45