How could I use high order func in my query?
ArtZoick opened this issue · 1 comments
ArtZoick commented
I want to initiate a query using higher-order functions with the following sql, but I can't find the usage method in the document, how to use this query?
select * from test_table where arrayExists(x -> x LIKE '192.168.1.1%',host_list)=1
sswest commented
Since ORM will escape strings, you cannot directly pass the higher-order function string type to F, but you can easily customize a class and implement the str method, such as
class Lambda:
def __init__(self, symbol: str):
self.symbol = symbol
def __str__(self):
return self.symbol
F("arrayExists", Lambda("x -> x LIKE '192.168.1.1%'"), host_list)