I have a simple FlowFile which contains JSON:
{
"name" : "ga:sessions",
"val" : "0"
}
And some attributes:
account.login = "some_email@gmail.com"
account.id = "123456789"
I want to use QueryRecord
processor to prepare JSON for saving into database.
But I get an error:
QueryRecord
successfully set account_login
from attribute but returns error. What is the problem? If I will not use attributes in QueryRecord
SQL statement, I'll not get an error:
[{
"metric_name" : "ga:sessions",
"metric_value" : "0"
}]
How to solve it?
In order for QueryRecord to recognize the literal string value in the query, you should use apostrophes.
Your query should look like this:
SELECT name AS metric_name,
val AS metric_value,
'${account.login}' as account_login
FROM FLOWFILE