【问题标题】:BigQuery API limit exceeded errorBigQuery API 超出限制错误
【发布时间】:2016-09-29 14:02:14
【问题描述】:

tabledata.list 期间出现错误并显示消息:

API limit exceeded: Unable to return a row that exceeds the API limits. To retrieve the row, export the table.

它没有在https://cloud.google.com/bigquery/troubleshooting-errors#errortable 列出。

这个错误每次都会发生。

我们可以正常将这张表导出到GCS中。结果看起来很正常(没有特别大的行)。

我们设法在实际错误发生之前检索了几个结果页面。

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "API limit exceeded: Unable to return a row that exceeds the API limits. To retrieve the row, export the table.",
    "reason" : "apiLimitExceeded"
  } ],
  "message" : "API limit exceeded: Unable to return a row that exceeds the API limits. To retrieve the row, export the table."
}
    at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) ~[com.google.api-client.google-api-client-1.21.0.jar:1.21.0]
    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) ~[com.google.api-client.google-api-client-1.21.0.jar:1.21.0]
    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) ~[com.google.api-client.google-api-client-1.21.0.jar:1.21.0]
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321) ~[com.google.api-client.google-api-client-1.21.0.jar:1.21.0]

这是什么意思?我们如何解决这个错误?

【问题讨论】:

  • 使用 CLI 运行 bq 查询时出现以下错误:查询操作中的 BigQuery 错误:超出 API 限制:无法返回超过 API 限制的行。要检索行,请导出表。 bq --location=US query --destination_table dataset.table --replace --use_legacy_sql=false --allow_large_results --service_account_credential_file xxx.json --project_id yyyy '' 但是,对于同一个 SQL 语句,我可以让它在Web界面中运行。有什么办法可以在 CLI 中解决这个错误?

标签: google-bigquery


【解决方案1】:

很抱歉给您带来不便。

这是 tabledata.list 方法的一个已知问题。 问题是我们有一些基础设施限制,目前无法从 tabledata.list 返回非常 large 行。

large 是一个相对的词。不幸的是,当以 json 表示时,某些行的大小很小,但以我们的内部格式表示时会消耗大量内存。

当前的解决方法如错误消息中所述:导出表。

从长远来看,我们正在积极改进我们的系统以克服这一限制。敬请期待:)

【讨论】:

  • 您能透露更多信息吗?所以,我已经导出了这张表。这个“坏”行是在出口,不是吗?看来,这个问题不在于常规数据类型(如 Int/String)。顺便说一句,该表中最长的字符串是 5Kb(40 多个字段)。我们的模式中有 2 个重复的字段(字符串)。最大的包含 27 个重复值,共 450 个字节。我们想在写入 BQ 之前引入合理的限制。但是我们没有任何想法,什么是“合理”。
【解决方案2】:

tabledata.list 有两个与行相关的限制:

  1. proto 消息的字节大小必须小于 10M。如果一行大于此大小,我们将无法检索它。

  2. 行中的最大字段值必须小于350,000,即一行的叶字段数。

如果你遇到了这个问题,它通常只意味着你的请求中的第一行太大而无法返回,如果你跳过那一行,下面的行检索可能会起作用。您可以尝试仔细查看特定行以了解原因。

将来可能会取消字段值限制,但由于 API 服务器的限制,我们仍然会有 10M 的大小限制。

【讨论】:

  • 有没有办法跳过超过 API 限制的行?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-19
  • 1970-01-01
  • 1970-01-01
  • 2019-03-27
  • 2021-04-26
相关资源
最近更新 更多