Forum Discussion
tstack
6 years agoFormer Employee
In order to access values from input documents (or other expression language variables) in a SQL statement, you need to use a JSON-Path. For example, if there was a document going into this snap, you would reference a property in it using $name
. In the case of pipeline parameters though, it’s a little different. You need to use $.eval(<expr>)
to evaluate an expression and then you put the pipeline parameter reference in there. So, you would write:
SELECT count(*) as cnt
FROM FDR_SOURCE.KRONOS_LABORtest
WHERE SOURCE_FILENAME = $.eval(_Name)
Note that this approach is the safest since it is using bound variables, so there is no possibility of a SQL injection vulnerability.