summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_compiler.py
diff options
context:
space:
mode:
authorJack Zhou <univerio@gmail.com>2016-05-31 10:01:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-06-02 17:46:16 -0400
commite8f97c9e357ed0793ce11086823f83aa4a8bb4ad (patch)
treee87b5fbd22799b56ab771197fd4658afddd08c91 /test/dialect/postgresql/test_compiler.py
parenteb28ebb0f8a48ba57f68f21d64479b56bf689d24 (diff)
downloadsqlalchemy-e8f97c9e357ed0793ce11086823f83aa4a8bb4ad.tar.gz
Add SKIP LOCKED support for Postgresql, Oracle
This adds `SELECT ... FOR UPDATE SKIP LOCKED`/ `SELECT ... FOR SHARE SKIP LOCKED` rendering. Change-Id: Id1dc4f1cafc1de23f397a6f73d54ab2c58d5910d Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/86
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r--test/dialect/postgresql/test_compiler.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index c20e48b01..c061cfaf1 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -606,6 +606,13 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
"FROM mytable WHERE mytable.myid = %(myid_1)s FOR UPDATE NOWAIT")
self.assert_compile(
+ table1.select(table1.c.myid == 7).
+ with_for_update(skip_locked=True),
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable WHERE mytable.myid = %(myid_1)s "
+ "FOR UPDATE SKIP LOCKED")
+
+ self.assert_compile(
table1.select(table1.c.myid == 7).with_for_update(read=True),
"SELECT mytable.myid, mytable.name, mytable.description "
"FROM mytable WHERE mytable.myid = %(myid_1)s FOR SHARE")
@@ -618,6 +625,13 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(
table1.select(table1.c.myid == 7).
+ with_for_update(read=True, skip_locked=True),
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable WHERE mytable.myid = %(myid_1)s "
+ "FOR SHARE SKIP LOCKED")
+
+ self.assert_compile(
+ table1.select(table1.c.myid == 7).
with_for_update(of=table1.c.myid),
"SELECT mytable.myid, mytable.name, mytable.description "
"FROM mytable WHERE mytable.myid = %(myid_1)s "
@@ -645,6 +659,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
"FROM mytable WHERE mytable.myid = %(myid_1)s "
"FOR SHARE OF mytable NOWAIT")
+ self.assert_compile(
+ table1.select(table1.c.myid == 7).
+ with_for_update(read=True, skip_locked=True,
+ of=[table1.c.myid, table1.c.name]),
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable WHERE mytable.myid = %(myid_1)s "
+ "FOR SHARE OF mytable SKIP LOCKED")
+
ta = table1.alias()
self.assert_compile(
ta.select(ta.c.myid == 7).