summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-02-20 09:42:34 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-02-20 09:42:34 -0500
commit7a8262e56b63e7a5119bbc83d5ccb59958e6b5c5 (patch)
treefbc3676dbac04c52cb85eabc716f4f7e5f01360d
parent63466d106d9b5e0bec098f0c689f9e3ac3475a13 (diff)
downloadsqlalchemy-7a8262e56b63e7a5119bbc83d5ccb59958e6b5c5.tar.gz
add doc for with_lockmode(), [ticket:2412]
-rw-r--r--lib/sqlalchemy/orm/query.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 1f6d0df2b..6e271f863 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -970,7 +970,22 @@ class Query(object):
@_generative()
def with_lockmode(self, mode):
- """Return a new Query object with the specified locking mode."""
+ """Return a new Query object with the specified locking mode.
+
+ :param mode: a string representing the desired locking mode. A
+ corresponding value is passed to the ``for_update`` parameter of
+ :meth:`~sqlalchemy.sql.expression.select` when the query is
+ executed. Valid values are:
+
+ ``'update'`` - passes ``for_update=True``, which translates to
+ ``FOR UPDATE`` (standard SQL, supported by most dialects)
+
+ ``'update_nowait'`` - passes ``for_update='nowait'``, which
+ translates to ``FOR UPDATE NOWAIT`` (supported by Oracle)
+
+ ``'read'`` - passes ``for_update='read'``, which translates to
+ ``LOCK IN SHARE MODE`` (supported by MySQL).
+ """
self._lockmode = mode