diff options
author | Sergey Skopin <prn.s_skopin@wargaming.net> | 2016-05-31 12:59:47 +0300 |
---|---|---|
committer | Sergey Skopin <prn.s_skopin@wargaming.net> | 2016-05-31 12:59:47 +0300 |
commit | 9b4e47bc6471d68c135817f39625aa471804090e (patch) | |
tree | 72003fa1448408015a8070a4419a1b9606ce9b3b /test/dialect/postgresql/test_compiler.py | |
parent | c124fa36d5af2c85c87c51d24e92387adffbe3d2 (diff) | |
download | sqlalchemy-pr/279.tar.gz |
Add 'FOR NO KEY UPDATE' supportpr/279
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 87e48d3f2..6ff1102e6 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -602,6 +602,43 @@ 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(no_key=True, nowait=True, + of=[table1.c.myid, table1.c.name]), + "SELECT mytable.myid, mytable.name, mytable.description " + "FROM mytable WHERE mytable.myid = %(myid_1)s " + "FOR NO KEY UPDATE OF mytable NOWAIT") + + self.assert_compile( + table1.select(table1.c.myid == 7). + with_for_update(no_key=True, + of=[table1.c.myid, table1.c.name]), + "SELECT mytable.myid, mytable.name, mytable.description " + "FROM mytable WHERE mytable.myid = %(myid_1)s " + "FOR NO KEY UPDATE OF mytable") + + self.assert_compile( + table1.select(table1.c.myid == 7). + with_for_update(no_key=True), + "SELECT mytable.myid, mytable.name, mytable.description " + "FROM mytable WHERE mytable.myid = %(myid_1)s " + "FOR NO KEY UPDATE") + + self.assert_compile( + table1.select(table1.c.myid == 7). + with_for_update(no_key=True), + "SELECT mytable.myid, mytable.name, mytable.description " + "FROM mytable WHERE mytable.myid = %(myid_1)s " + "FOR NO KEY UPDATE") + + assert_raises( + exc.ArgumentError, + table1.select(table1.c.myid == 7).with_for_update, + no_key=True, + read=True + ) + ta = table1.alias() self.assert_compile( ta.select(ta.c.myid == 7). |