summaryrefslogtreecommitdiff
path: root/test/dialect
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2016-06-03 10:56:06 -0400
committerGerrit Code Review <gerrit2@ln3.zzzcomputing.com>2016-06-03 10:56:06 -0400
commita6817579cee4fb2569d961b611a4190f3f9fb7ee (patch)
treea0655fc134d4e2e0e5d479ed4649fd9b02935dd9 /test/dialect
parent40f9bcf1112bf25fd87a45cbf08f64c305d055a1 (diff)
parente8f97c9e357ed0793ce11086823f83aa4a8bb4ad (diff)
downloadsqlalchemy-a6817579cee4fb2569d961b611a4190f3f9fb7ee.tar.gz
Merge "Add SKIP LOCKED support for Postgresql, Oracle"
Diffstat (limited to 'test/dialect')
-rw-r--r--test/dialect/postgresql/test_compiler.py22
-rw-r--r--test/dialect/test_oracle.py7
2 files changed, 29 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).
diff --git a/test/dialect/test_oracle.py b/test/dialect/test_oracle.py
index 1f3e63040..816741231 100644
--- a/test/dialect/test_oracle.py
+++ b/test/dialect/test_oracle.py
@@ -334,6 +334,13 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
"FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE OF "
"mytable.myid, mytable.name NOWAIT")
+ self.assert_compile(
+ table1.select(table1.c.myid == 7).
+ with_for_update(skip_locked=True, of=[table1.c.myid, table1.c.name]),
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE OF "
+ "mytable.myid, mytable.name SKIP LOCKED")
+
ta = table1.alias()
self.assert_compile(
ta.select(ta.c.myid == 7).