I use the firebase cloud function and I have a function that gets an SQL request and calls bigquery and returns the results to my iOS/Android app. but if I want to send multiple requests I just get 1 result. I read about that and I found that I need to do it with jobs, somebody can help me with that?
exports.callBigQuery = async (data, context) => {
const queryFrom = data.text;
const [rows] = [];
const options = {
query: queryFrom,
};
const [jobs] = await bigqueryClient.createQueryJob(options);
jobs.forEach(job => {
const item = job.getQueryResults();
rows.push(item);
console.log(item);
});
console.log(rows);
return rows;
};
This is the query that i send to the "callBigQuery" function(if I run it on the bigquery console I get 2 results):
let str = "SELECT * FROM 'table_name_1' where isWorking = 'true' limit 1; SELECT * FROM `table_name_2` where isWorking = 'true'"