summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-11-28 14:30:05 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-11-28 14:30:05 -0500
commitc90f0a49f332867f6b337c79ddf192299788667f (patch)
treeb806df31d3cef0fa1510bea6a46d76c0b72cf4f5 /lib/sqlalchemy/orm/query.py
parent1202e140b9876cf202c56d2f41bbbb573e15a39d (diff)
downloadsqlalchemy-c90f0a49f332867f6b337c79ddf192299788667f.tar.gz
- Added support for parameter-ordered SET clauses in an UPDATE
statement. This feature is available by passing the :paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order` flag either to the core :class:`.Update` construct or alternatively adding it to the :paramref:`.Query.update.update_args` dictionary at the ORM-level, also passing the parameters themselves as a list of 2-tuples. Thanks to Gorka Eguileor for implementation and tests. adapted from pullreq github:200
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 84fb04d80..4441975bf 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -2910,7 +2910,12 @@ class Query(object):
:param values: a dictionary with attributes names, or alternatively
mapped attributes or SQL expressions, as keys, and literal
- values or sql expressions as values.
+ values or sql expressions as values. If :ref:`parameter-ordered
+ mode <updates_order_parameters>` is desired, the values can be
+ passed as a list of 2-tuples;
+ this requires that the :paramref:`~sqlalchemy.sql.expression.update.preserve_parameter_order`
+ flag is passed to the :paramref:`.Query.update.update_args` dictionary
+ as well.
.. versionchanged:: 1.0.0 - string names in the values dictionary
are now resolved against the mapped entity; previously, these
@@ -2941,7 +2946,8 @@ class Query(object):
:param update_args: Optional dictionary, if present will be passed
to the underlying :func:`.update` construct as the ``**kw`` for
the object. May be used to pass dialect-specific arguments such
- as ``mysql_limit``.
+ as ``mysql_limit``, as well as other special arguments such as
+ :paramref:`~sqlalchemy.sql.expression.update.preserve_parameter_order`.
.. versionadded:: 1.0.0