Task: BigQuery SQL request

n8n workflow:
{"meta":{"instanceId":"f0a68da631efd4ed052a324b63ff90f7a844426af0398a68338f44245d1dd9e5"},"nodes":[{"id":"4b5a31bc-7855-4167-bac4-19d5400bcdb7","name":"Schema","type":"n8n-nodes-base.set","position":[740,260],"parameters":{"values":{"string":[{"name":"schema","value":"={{$json[\"schema\"]}}"}]},"options":{},"keepOnlySet":true},"typeVersion":1},{"id":"94399300-c24b-4447-9f46-f2f4db2009ea","name":"Rows","type":"n8n-nodes-base.set","position":[740,420],"parameters":{"values":{"string":[{"name":"rows","value":"={{$json[\"rows\"]}}"}]},"options":{},"keepOnlySet":true},"typeVersion":1},{"id":"65c81d4f-e4ba-4d03-a04e-42df47c3519e","name":"Merge","type":"n8n-nodes-base.merge","position":[960,340],"parameters":{"mode":"combine","options":{"includeUnpaired":false},"combinationMode":"mergeByPosition"},"typeVersion":2},{"id":"494d18ae-5e40-4811-8984-7b6509d77fed","name":"Convert to table","type":"n8n-nodes-base.function","position":[1120,340],"parameters":{"functionCode":"function convertBQToMySQLResults(schema, rows) {\n\n    var resultRows = []\n    \n    function recurse (schemaCur, rowsCur, colName) {\n\n        if (Array.isArray(schemaCur) && !Array.isArray(result[colName])) {\n            for(var i=0, l=schemaCur.length; i<l; i++) {\n                if (colName === \"\")\n                    recurse(schemaCur[i], rowsCur.f[i], colName + schemaCur[i].name)\n                else\n                    recurse(schemaCur[i], rowsCur.f[i], colName + \".\" + schemaCur[i].name)\n            }    \n        }\n\n        if (schemaCur.type && schemaCur.type === \"RECORD\") {\n            if (schemaCur.mode !== \"REPEATED\") {\n                var valIndex = 0\n                for (var p in schemaCur.fields) {\n                    if (rowsCur.v === null) {\n                        recurse(schemaCur.fields[p], rowsCur, colName + \".\" + schemaCur.fields[p].name)\n                    } else {\n                        recurse(schemaCur.fields[p], rowsCur.v.f[valIndex], colName + \".\" + schemaCur.fields[p].name)\n                    }\n                    \n                    valIndex++\n                }\n            } \n            \n            if (schemaCur.mode === \"REPEATED\") {   \n                result[colName] = [] \n                for (var x in rowsCur.v) {\n                    recurse(schemaCur.fields, rowsCur.v[x], colName)\n                }\n            }\n        } else {\n            if (schemaCur.mode === \"REPEATED\") {\n                if (rowsCur.v !== null) {\n                    result[colName] = rowsCur.v.map( (value, index) => { return value.v })\n                } else {\n                    result[colName] = [ null ]\n                }\n                \n            } else if (Array.isArray(result[colName])) {\n                let nextRow = {} \n                for (var j in schemaCur) {\n                    nextRow[colName + \".\" + schemaCur[j].name] = Array.isArray(rowsCur.v.f[j].v) ? rowsCur.v.f[j].v.map( (value, index) => { return value.v }) : rowsCur.v.f[j].v \n                }\n                result[colName].push(nextRow)\n            } else {\n                if (colName !== \"\")\n                    result[colName] = rowsCur.v\n            }\n        }\n    }\n\n    for (var r=0, rowsCount=rows.length; r<rowsCount; r++) {\n        var result = {};\n        recurse(schema, rows[r], \"\")\n        resultRows.push(result)\n    }\n\n    return resultRows\n}\n\nconst rows = convertBQToMySQLResults(items[0].json.schema.fields, items[0].json.rows);\nreturn rows.map(row => ({json: row}));"},"typeVersion":1},{"id":"6ddcb65f-e79f-4432-bb93-6072dbc1262a","name":"BigQuery Request","type":"n8n-nodes-base.httpRequest","position":[520,320],"parameters":{"url":"https://bigquery.googleapis.com/bigquery/v2/projects/datawarehouse-prod-381508/queries","method":"POST","options":{},"jsonBody":"={\n  \"query\": {{ JSON.stringify($json[\"SQL\"]) }},\n  \"useLegacySql\": false\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"googleBigQueryOAuth2Api"},"credentials":{"googleBigQueryOAuth2Api":{"id":"119","name":"Data BigQuery  "}},"typeVersion":3},{"id":"a0c3c36a-964a-4f19-b6f5-a1c6643d8481","name":"GET SQL","type":"n8n-nodes-base.set","position":[320,320],"parameters":{"values":{"string":[{"name":"SQL","value":"={{ $json[\"query\"] }}"}]},"options":{},"keepOnlySet":true},"typeVersion":1},{"id":"c815f6b7-4000-4c64-9dab-bca88727ca59","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[120,320],"parameters":{},"typeVersion":1}],"connections":{"Rows":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Merge":{"main":[[{"node":"Convert to table","type":"main","index":0}]]},"Schema":{"main":[[{"node":"Merge","type":"main","index":0}]]},"GET SQL":{"main":[[{"node":"BigQuery Request","type":"main","index":0}]]},"BigQuery Request":{"main":[[{"node":"Schema","type":"main","index":0},{"node":"Rows","type":"main","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"GET SQL","type":"main","index":0}]]}}}