【发布时间】:2015-06-23 13:23:36
【问题描述】:
我已经创建了 C#.NET 应用程序(使用服务身份验证)。
我正在尝试运行 select 语句(来自 Google BigQuery 的公共示例表)并将结果加载到数据表中,但无法实现,它会抛出错误
查询导致错误是:“SELECT * FROM [publicdata:samples.github_timeline]”
Google.Apis.Requests.RequestError
Response too large to return. Consider setting allowLargeResults to true in your job configuration. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors [403]
Errors [
Message[Response too large to return. Consider setting allowLargeResults to true in your job configuration. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors] Location[ - ] Reason[responseTooLarge] Domain[global]
].
这是 C# 代码。
String serviceAccountEmail = "SERVICE ACCOUNT EMAIL ADDRESS";
var certificate = new X509Certificate2(@"KEY FILE NAME", "KEY SECRET", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { BigqueryService.Scope.Bigquery, BigqueryService.Scope.BigqueryInsertdata, BigqueryService.Scope.CloudPlatform, BigqueryService.Scope.DevstorageFullControl }
}.FromCertificate(certificate));
BigqueryService Service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "PROJECT NAME"
});
string query = "SELECT * FROM [publicdata:samples.github_timeline]";
JobsResource j = Service.Jobs;
QueryRequest qr = new QueryRequest();
string ProjectID = "PROJECT ID";
qr.Query = query;
qr.MaxResults = Int32.MaxValue;
qr.TimeoutMs = Int32.MaxValue;
DataTable DT = new DataTable();
int i = 0;
QueryResponse response = j.Query(qr, ProjectID).Execute();
我们如何选择大型数据集并将结果以最佳方式加载到 Datatable 中?担心 BigQuery 会引发这些类型的错误,那么我们将如何相信我们的程序可以 100% 运行。
【问题讨论】:
标签: google-api google-bigquery google-api-dotnet-client