gpt4 book ai didi

google-bigquery - 将记录插入 BigQuery 流与简单插入 - 使用 table->insertRow 或 table->inserRows 与使用 bigquery->runquery

转载 作者:行者123 更新时间:2023-12-03 13:45:05 25 4
gpt4 key购买 nike

如果我使用 table->insertRow() 或 table->inserRows() 函数,那意味着我正在将数据流式传输到 bigquery。

https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.53.0/bigquery/table

但是如果我使用 bigquery->runQuery() 函数来运行插入语句,那不是流式传输。

https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.53.0/bigquery/bigqueryclient?method=runQuery

在什么情况下我应该使用流来插入数据?在什么情况下,我应该使用 bigquery runQuery 来运行插入语句?

谢谢!

最佳答案

作为对@GrahamPolley 在您的问题的评论中提供的答案的补充(并且为了让社区更容易获得答案),让我分享一些可能对您提出的问题有用的文档链接在这个帖子里做的。

流式插入与 DML 插入

流式插入使用 tabledata.insertAll method在表中一次插入一条记录,并且不需要运行加载作业。在 this documentation page ,您可以找到与流式插入、其功能、限制和配额相关的所有信息。

正如对您的问题的评论所述,使用 DML 插入您只能执行 1000 INSERT queries per table per day (还有 the same limit applies to load jobs),而对于流式插入,您 don't have a limit per day ,并且只有每秒最大行数和请求。

数据可用性

流式传输到 BigQuery 的数据在表中第一次流式插入后很快(几秒钟内)即可使用,即使它在缓冲区中也是如此。然而,this data may be unavailable for other operations (例如复制、导出甚至 some API methods like tabledata.list ),因此如果您正在执行其中任何一项,您首先必须检查缓冲区是否为空。您可以通过检查来自 tables.get 的响应来做到这一点。在名为 streamingBuffer 的部分中,这应该是空的缓冲区是空的。

关于google-bigquery - 将记录插入 BigQuery 流与简单插入 - 使用 table->insertRow 或 table->inserRows 与使用 bigquery->runquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48797143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com