diff options
| author | Sergey Skopin <sa.skopin@gmail.com> | 2016-05-31 10:02:08 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-06-08 11:24:57 -0400 |
| commit | 3ebd1b30eb392ff62f08f0755e79a228d61ba7d2 (patch) | |
| tree | 931e6f3aca0c73a3bc0664e69b2446ac110bf045 /doc | |
| parent | a90b0101aaf616cddb8bc675f4a221fe7de6c420 (diff) | |
| download | sqlalchemy-3ebd1b30eb392ff62f08f0755e79a228d61ba7d2.tar.gz | |
Add 'FOR NO KEY UPDATE' / 'FOR KEY SHARE' support for Postgresql
Adds ``key_share=True`` for with_for_update().
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I74e0c3fcbc023e1dc98a1fa0c7db67b4c3693a31
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/279
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/changelog/changelog_11.rst | 10 | ||||
| -rw-r--r-- | doc/build/changelog/migration_11.rst | 22 |
2 files changed, 27 insertions, 5 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst index 297be5d2d..cc4c6aa7c 100644 --- a/doc/build/changelog/changelog_11.rst +++ b/doc/build/changelog/changelog_11.rst @@ -98,6 +98,16 @@ Alex Grönholm. .. change:: + :tags: feature, postgresql + :pullreq: github:297 + + Added new parameter + :paramref:`.GenerativeSelect.with_for_update.key_share`, which + will render the ``FOR NO KEY UPDATE`` version of ``FOR UPDATE`` + and ``FOR KEY SHARE`` instead of ``FOR SHARE`` + on the Postgresql backend. Pull request courtesy Sergey Skopin. + + .. change:: :tags: feature, postgresql, oracle :pullreq: bitbucket:86 diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst index d9f48fcb1..712eb0b4a 100644 --- a/doc/build/changelog/migration_11.rst +++ b/doc/build/changelog/migration_11.rst @@ -2121,13 +2121,25 @@ should be calling upon ``sqlalchemy.dialects.postgresql``. Engine URLs of the form ``postgres://`` will still continue to function, however. -Support for SKIP LOCKED ------------------------ +Support for FOR UPDATE SKIP LOCKED / FOR NO KEY UPDATE / FOR KEY SHARE +----------------------------------------------------------------------- -The new parameter :paramref:`.GenerativeSelect.with_for_update.skip_locked` -in both Core and ORM will generate the "SKIP LOCKED" suffix for a -"SELECT...FOR UPDATE" or "SELECT.. FOR SHARE" query. +The new parameters :paramref:`.GenerativeSelect.with_for_update.skip_locked` +and :paramref:`.GenerativeSelect.with_for_update.key_share` +in both Core and ORM apply a modification to a "SELECT...FOR UPDATE" +or "SELECT...FOR SHARE" query on the Postgresql backend: + +* SELECT FOR NO KEY UPDATE:: + + stmt = select([table]).with_for_update(key_share=True) + +* SELECT FOR UPDATE SKIP LOCKED:: + + stmt = select([table]).with_for_update(skip_locked=True) + +* SELECT FOR KEY SHARE:: + stmt = select([table]).with_for_update(read=True, key_share=True) Dialect Improvements and Changes - MySQL ============================================= |
