operators.update(
{
sql_operators.mod : '%%',
- sql_operators.ilike_op: 'ILIKE'
+ sql_operators.ilike_op: 'ILIKE',
+ sql_operators.notilike_op: 'NOT ILIKE'
}
)
operators.like_op : 'LIKE',
operators.notlike_op : 'NOT LIKE',
operators.ilike_op : lambda x, y: "lower(%s) LIKE lower(%s)" % (x, y),
- operators.notilike_op : 'NOT ILIKE',
+ operators.notilike_op : lambda x, y: "lower(%s) NOT LIKE lower(%s)" % (x, y),
operators.between_op : 'BETWEEN',
operators.in_op : 'IN',
operators.notin_op : 'NOT IN',
def testilike(self):
stmt = table1.select(table1.c.name.ilike('%something%'))
- self.assert_compile(stmt, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE lower(mytable.name) LIKE :mytable_name_1")
+ self.assert_compile(stmt, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE lower(mytable.name) LIKE lower(:mytable_name_1)")
self.assert_compile(stmt, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.name ILIKE %(mytable_name_1)s", dialect=postgres.PGDialect())
+ stmt = table1.select(~table1.c.name.ilike('%something%'))
+ self.assert_compile(stmt, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE lower(mytable.name) NOT LIKE lower(:mytable_name_1)")
+ self.assert_compile(stmt, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.name NOT ILIKE %(mytable_name_1)s", dialect=postgres.PGDialect())
+
def testforupdate(self):
self.assert_compile(table1.select(table1.c.myid==7, for_update=True), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :mytable_myid_1 FOR UPDATE")