I’m trying to use Google Apps Scripts to wrangle and remodel BigQuery data via a series of select / insert statements
My 15+ Select statements are complicated and for maintainability ideally belong inside of BigQuery (as opposed to embedded within JavaScript). I would like to reference the Saved Project Query from BigQuery from within Google Scripts in place of the embedded query. So the following query statement
body =
{
configuration:
{
query:
{
query: 'SELECT foo, bar FROM FooBarProjcet;',
writeDisposition:'WRITE_APPEND',
destinationTable:
{
projectId: projectId,
datasetId: datasetId,
tableId: 'TestScript'
}
},
}
}
would become something like
body =
{
configuration:
{
query:
{
query: BigQuery.ProjectQuery.FooBarSelect,
writeDisposition:'WRITE_APPEND',
destinationTable:
{
projectId: projectId,
datasetId: datasetId,
tableId: 'TestScript'
}
},
}
}
Is this possible? Are the BigQuery saved project queries exposed to the APi?