will do this. Helps with Alembic "offline"
scripts.
+- mssql
+ - [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]
+
- mysql
- [bug] Unicode adjustments allow latest pymysql
(post 0.4) to pass 100% on Python 2.
'writetext',
])
-
class REAL(sqltypes.REAL):
__visit_name__ = 'REAL'
return s
return compiler.SQLCompiler.get_select_precolumns(self, select)
- def get_from_hint_text(self, text):
+ def get_from_hint_text(self, table, text):
return text
def limit_clause(self, select):
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(),