Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Build dynamic queries from a json array NIFI

New Contributor

I have a json file on HDFS , which is a json array of 20 entries.

I have a folder with multiple(4) SQL files to be run on Impala.

Now what I need help is in how to fetch each json object and then replace the SQL dynamically based on the json object parameters and run all the SQL's for that index and store the results on HDFS , and then continue for rest of the json entries, and so on.

For ex:

{
"coffee": [{
"region": "US",
"code": "122"
},
{
"region": "KZR",
"code": "123"
},
{
"region": "PAK",
"code": "124"
},
{
"region": "AFG",
"code": "128"
}]
}


SQL file 1 :

select * from test.test_table where region=<region> and code=<code>

SQL file 2 :

select fragment_id from test.test_table where region=<region> and code=<code>




0 REPLIES 0
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.