如何使用应用程序脚本运行谷歌大查询,并将其保存为一个新的表,我们可以重复使用? [英] How to use App script to run a google big query and save it as a new table which can we reused?
本文介绍了如何使用应用程序脚本运行谷歌大查询,并将其保存为一个新的表,我们可以重复使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用应用程序脚本运行谷歌大查询并将结果保存在Google大查询中相同项目文件夹中的新表中
解决方案
function saveQueryToTable(){
var projectId ='您的项目';
var datasetId ='你的数据集';
var tableId ='你的桌子';
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);
}
更多示例 here 。
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
解决方案
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.
这篇关于如何使用应用程序脚本运行谷歌大查询,并将其保存为一个新的表,我们可以重复使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文