[英]How can I use BigQuery streaming insertall in PHP without using OAuth2 or a permanent key?
How can use bigquery streaming insertall from server to server without use oauth2 or using a permament key? 如何在不使用oauth2或使用永久密钥的情况下使用bigquery流插入从服务器到服务器?
I need to insert about 20,000 rows per minute one-to-one. 我需要每分钟插入大约20,000行一对一。 All the examples that I saw are using Google api client with oauth.
我看到的所有示例都使用带有oauth的Google api客户端。 On the other hand, in BigQuery API explorer:
另一方面,在BigQuery API资源管理器中:
(https://developers.google.com/bigquery/docs/reference/v2/tabledata/insertAll)
I saw this url POST: 我看到这个网址:
https://www.googleapis.com/bigquery/v2/projects/projectId/datasets/datasetId/tables/tableId/insertAll?key=apikey
I can create a server key, but it returns a login required note. 我可以创建一个服务器密钥,但它返回一个需要登录的注释。 Is it possible to send a large amount of inserts without doing a request token for each insert?
是否可以在不为每个插入执行请求令牌的情况下发送大量插入? Note that I am using PHP.
请注意,我使用的是PHP。
An OAuth2 access token is valid for something like an hour; OAuth2访问令牌有效期为一小时; if you use this you won't need to get a new one for each insert.
如果你使用它,你不需要为每个插入一个新的。 The PHP client should manage the token and request a new one when it expires.
PHP客户端应该管理令牌并在其到期时请求新令牌。
The other alternative is to use service account or PKS#12 auth. 另一种方法是使用服务帐户或PKS#12 auth。 This requires signing your requests, but it doesn't require an access token at all.
这需要签署您的请求,但根本不需要访问令牌。 See the docs here .
请参阅此处的文档。 The examples are in java and python, but the python one should be relatively easy to translate to PHP.
示例在java和python中,但python应该相对容易转换为PHP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.