Simulation Aids: IN operator with view() expression

Is it possible to use the SQL IN operator with view()?

SELECT * WHERE column_val IN ('str1','str2','str3')

Ideally I'd like to pass this as an argument:

SELECT * WHERE column_val IN args[0]
args[0] = "('str1',str2','str3')"

Figured it out, 'in' cannot be capitalized:

view(
SELECT * WHERE column_val in args[0],
{dataset_tag},
("'str1','str2'")
)
1 Like

The reason it cannot be capitalized is that it is not the SQL "IN" operator, but the python "in" operator. Expressions in my PseudoSQL are python. Particularly important for "equals" comparisons.

1 Like

Thanks for clarifying, I've found the module is incredibly useful for reducing the number of large polling queries made against a database that just requires small filter differences.

I'd like to make my 'in' list a variable that I build.
I can get this to work:


But the following will not work:

view('SELECT ORDER_NO WHERE SHORTAGE == "False" and HAS_OPEN_NCR == 0 and ACTIVE in (1,3,7,8) and DEST_STATION in args[0]', {[~]ZeelandData/Kanban/KanbanWOData} ,"(181, 441)" )'

This is a string, not a list. Cannot work, for the same reason you cannot do it with real JDBC and ? substitution.

Consider using the nestable iterators in V2, now called my Integration Toolkit.


I've tried asList({dataset}) also. However, it does not return the expected rows.
Seems like my list data isn't matching what is returned in my view. I've tried making everything strings also.

Looks like I was not defining my dataset enough


forEach({dataset}, it()['ColName'] )