是否可以使用C#/ python脚本查询公共大查询数据集,例如https://www.githubarchive.org/,而无需在Google Big Query上注册结算。我使用了附加的C#代码,但它给了我不足的权限[403]错误
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Security.Cryptography.X509Certificates;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using DotNetOpenAuth.OAuth2;
using Google.Apis.Bigquery.v2;
using Google.Apis.Bigquery.v2.Data;
using Google.Apis.Util;
namespace BQTry
{
public class BigQueryConsole
{
static string query = "SELECT count(*) FROM [githubarchive:year.2014]";
static string projectId = "some project id";
public static void Main(string[] args)
{
Console.WriteLine("BigQueryAPI STARTINg");
Console.WriteLine("==========================");
String serviceAccountEmail = "someaccount@developer.gserviceaccount.com";
var certificate = new X509Certificate2(@"G:\CW and Research\TERM 2\SM\PROJECT\Code\BQTry\key\somekye.p12", "notasecret", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { BigqueryService.Scope.DevstorageReadOnly }
}.FromCertificate(certificate));
// Create the service.
var service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "BigQuery API Sample",
});
//Note: all your requests will run against Service.
JobsResource j = service.Jobs;
QueryRequest qr = new QueryRequest();
qr.Query = query;
QueryResponse response = j.Query(qr, projectId).Execute();
}
}
}
答案 0 :(得分:1)
无论您做什么,都需要启用结算,或从已完成的项目中发送凭据。
快速回答你的问题:不。您需要启用结算功能。并不意味着,如果您所做的只是查询公共数据集,那么您将付出代价。
正如here所示,在此页面的链接文档中,每月处理数据的第一个TB是免费的。