How to use App script to run a google big query and save it as a new table which can we reused?

匿名 (未验证) 提交于 2019-12-03 02:43:01

问题:

How to use app script to run a google big query and save the results in a new table in the same project folder on google big query

回答1:

It will look like this:

function saveQueryToTable() {   var projectId = 'your project';   var datasetId = 'your dataset';   var tableId = 'your table';   var job = {     configuration: {       query: {         query: 'SELECT TOP(word, 300) AS word, COUNT(*) AS word_count' +                'FROM publicdata:samples.shakespeare' +                'WHERE LENGTH(word) > 10;',         destinationTable: {           projectId: projectId,           datasetId: datasetId,           tableId: tableId         }       }     }   };    var queryResults = BigQuery.Jobs.insert(job, projectId);   Logger.log(queryResults.status); } 

More examples here.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!