summaryrefslogtreecommitdiff
path: root/test/dialect/test_mssql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-12-03 20:04:55 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-12-03 20:04:55 -0500
commit2fca3c8ee89ba5a2924a66acdacd01f711b45679 (patch)
tree400e762043f7abd29e18414f4792d95066d49f09 /test/dialect/test_mssql.py
parent699146086df8fd8778582a03267f8f28c5cdad7a (diff)
downloadsqlalchemy-2fca3c8ee89ba5a2924a66acdacd01f711b45679.tar.gz
- [bug] repaired the with_hint() feature which
wasn't implemented correctly on MSSQL - usually used for the "WITH (NOLOCK)" hint (which you shouldn't be using anyway ! use snapshot isolation instead :) ) [ticket:2336]
Diffstat (limited to 'test/dialect/test_mssql.py')
-rw-r--r--test/dialect/test_mssql.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py
index f336f5f3b..75e9510eb 100644
--- a/test/dialect/test_mssql.py
+++ b/test/dialect/test_mssql.py
@@ -20,6 +20,35 @@ from sqlalchemy.engine.reflection import Inspector
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = mssql.dialect()
+ def test_select(self):
+ t = table('sometable', column('somecolumn'))
+ self.assert_compile(t.select(),
+ 'SELECT sometable.somecolumn FROM sometable')
+
+ def test_select_with_nolock(self):
+ t = table('sometable', column('somecolumn'))
+ self.assert_compile(t.select().with_hint(t, 'WITH (NOLOCK)'),
+ 'SELECT sometable.somecolumn FROM sometable WITH (NOLOCK)')
+
+ def test_join_with_hint (self):
+ t1 = table('t1',
+ column('a', Integer),
+ column('b', String),
+ column('c', String),
+ )
+ t2 = table('t2',
+ column("a", Integer),
+ column("b", Integer),
+ column("c", Integer),
+ )
+ join = t1.join(t2, t1.c.a==t2.c.a).\
+ select().with_hint(t1, 'WITH (NOLOCK)')
+ self.assert_compile(
+ join,
+ 'SELECT t1.a, t1.b, t1.c, t2.a, t2.b, t2.c '
+ 'FROM t1 WITH (NOLOCK) JOIN t2 ON t1.a = t2.a'
+ )
+
def test_insert(self):
t = table('sometable', column('somecolumn'))
self.assert_compile(t.insert(),