From 7142a17291deba2eb9d4a2b30e1635129c2284ea Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 21 Mar 2012 22:58:55 -0400 Subject: - [feature] Added new for_update/with_lockmode() options for Postgresql: for_update="read"/ with_lockmode("read"), for_update="read_nowait"/ with_lockmode("read_nowait"). These emit "FOR SHARE" and "FOR SHARE NOWAIT", respectively. Courtesy Diana Clarke [ticket:2445] --- lib/sqlalchemy/sql/expression.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 6e16d01f8..f37faa801 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -244,11 +244,18 @@ def select(columns=None, whereclause=None, from_obj=[], **kwargs): :param for_update=False: when ``True``, applies ``FOR UPDATE`` to the end of the - resulting statement. Certain database dialects also support - alternate values for this parameter, for example mysql - supports "read" which translates to ``LOCK IN SHARE MODE``, - and oracle supports "nowait" which translates to ``FOR UPDATE - NOWAIT``. + resulting statement. + + Certain database dialects also support + alternate values for this parameter: + + * With the MySQL dialect, the value ``"read"`` translates to + ``LOCK IN SHARE MODE``. + * With the Oracle and Postgresql dialects, the value ``"nowait"`` + translates to ``FOR UPDATE NOWAIT``. + * With the Postgresql dialect, the values "read" and ``"read_nowait"`` + translate to ``FOR SHARE`` and ``FOR SHARE NOWAIT``, respectively + (new in 0.7.7). :param group_by: a list of :class:`.ClauseElement` objects which will comprise the -- cgit v1.2.1