Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top