Facing some issues with my apps script that seems to run, but only selected lines and i'm not sure why. Was wondering if it could be an issue with standard SQL and some parameters. This is my code
function runQuery() {
var configuration = {
query: {
useQueryCache: false,
destinationTable: {
projectId: "projectA",
datasetId: "datasetA",
tableId: "NewTable"
},
writeDisposition: "WRITE_TRUNCATE",
createDisposition: "CREATE_IF_NEEDED",
allowLargeResults: true,
useLegacySql: false,
query: "WITH a AS" +
"(SELECT Date, Month, Quarter, Week, Year FROM Dataset.Table1`)," +
"b AS "+
"(SELECT * FROM `Dataset.Table2`)," +
"c AS "+
"(SELECT * FROM `Dataset.Table3`) " +
"SELECT Date, Month, Quarter, Week, Year, .... FROM a" +
"LEFT JOIN b ON a.x = b.x LEFT JOIN c ON a.x = c.x"
}
};
var job = {
configuration: configuration
};
var jobResult = BigQuery.Jobs.insert(job, "projectA");
Logger.log(jobResult);
}
(Have changed the variables and table names to blank out the contents, but the general structure of the code has been shown)
The SQL code itself works on BigQuery, so the issue is not with an error in the query.
When I attempt to run this, the log on BigQuery seems to show that the code executed is only the last 2 lines of the code, with a NaN in front
NaNSELECT Date, Month, Quarter, Week, Year, .... FROM a LEFT JOIN b ON a.x = b.x LEFT JOIN c ON a.x = c.x
Appreciate any help on this. Thanks
query: "WITH a AS" + "(SELEC
? and in the subsequent concat operators too – FKrauss