简体   繁体   中英

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?

I need to insert about 20,000 rows per minute one-to-one. All the examples that I saw are using Google api client with oauth. On the other hand, in BigQuery API explorer:

(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.

An OAuth2 access token is valid for something like an hour; 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.

The other alternative is to use service account or 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM