diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-21 22:58:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-21 22:58:55 -0400 |
commit | 7142a17291deba2eb9d4a2b30e1635129c2284ea (patch) | |
tree | aa0364a5a29d315c8ec7ea6f3ac402a6425ffa6b /lib/sqlalchemy/sql/expression.py | |
parent | 565b5dc537e8c155fb85878d477180a4c954b81f (diff) | |
download | sqlalchemy-7142a17291deba2eb9d4a2b30e1635129c2284ea.tar.gz |
- [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]
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 17 |
1 files changed, 12 insertions, 5 deletions
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 |