我正在尝试使用以下代码将 BigQuery 数据集从 Google Cloud Platform 下载到 R 工作区以对其进行分析:
library(bigrquery)
library(DBI)
library(tidyverse)
library(dplyr)
con = dbConnect(
bigquery(),
project = "bigquery-public-data",
dataset = "new_york_citibike",
billing = "maanan-bigquery-in-r"
)
bigrquery::bq_auth()
my_db_pointer = tbl(con, "citibike_trips")
glimpse(my_db_pointer)
count(my_db_pointer)
selected = select(my_db_pointer, everything()) %>% collect()
但是,当我尝试运行最后一行以下载数据时,它返回以下错误:
Complete
Billed: 0 B
Downloading first chunk of data.
Received 55,308 rows in the first chunk.
Downloading the remaining 58,882,407 rows in 1420 chunks of (up to) 41,481 rows.
Downloading data [=====>--------------------------------------------------------------------------------------------------] 6% ETA: 19m
Error in `signal_reason()`:
! Exceeded rate limits: Your project:453562790213 exceeded quota for tabledata.list bytes per second per project. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors [rateLimitExceeded]
ℹ Try increasing the `page_size` value of `bq_table_download()`
Run `rlang::last_error()` to see where the error occurred.
如果有人能帮我修复这个错误并下载数据,我将不胜感激?我需要分析数据集。提前谢谢你。
最佳答案
根据关于 rateLimitExceeded 的文档链接, 看起来你突破了 query jobs 的阈值.
请考虑以下事项:
检查您的项目
bigquery api
是否具有您在执行操作时可能会违反的设置限制和配额。要查看您当前的配额和限制,请转到 IAM 和管理 > 配额 > 项目“projectid”的配额> bigquery.google.apis.com由于您的 block 大约是
55,308 行
,每个58,882,407 行
block ,看来您正在尝试下载它允许的更多数据,您可能会遇到问题以下限制:查询/脚本执行时间限制
、最大响应大小
、最大行大小
。验证是否 table constraints没有达到。特别是关于
每天的操作数
。检查您的行的列数。有 10,000 列的限制。
考虑检查 query jobs 上指定的所有剩余配额限制.
减少选择的范围或减少 block 的大小。百万记录其真正需要的一切表?。你可以执行这样的操作:
library(bigrquery) # authenticate # use if notebook is outside gcp #bigrquery::bq_auth(path = '/Users/me/restofthepath/bigquery- credentials.json') bq_table_download("my-project-id.dataset-id.table", page_size = 100)
有关此功能的更多详细信息,请查看 bq_table_download
关于R bigrquery : Exceeded rate limits,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71494858/