Forum Discussion
Ideally, you’d be able to write a WHERE clause in the Select snap that referenced the ID array in the input document (e.g. the_id in $the_ids
). But, I don’t think that’s well supported by JDBC drivers. For now, you’ll probably need to use an expression to expand the array into something like the_id in ($the_ids[0], $the_ids[1], ..., $the_ids[N])
. Since that’s a bit complicated, I’ve created an expression library that has a function to do just that:
You can include that library in your pipeline and then use the following snippet to call the function in the “Where clause” property of the Select snap:
lib.sqlhelper.inArray('the_id', $, '$the_ids')
Here’s a screenshot of a Select snap with the property configured and an example of the generated SQL fragment:
I’ll also file a feature request to see if the snaps can be updated to more naturally support this use case.