azekirel555
azekirel555

Reputation: 587

Inserting and updating data with BigQuery's API

I'm trying to insert and update data from a mobile app every time an user opens an app and logs into Facebook.

Is it possible to insert and update specific rows from a table using BigQuery's API ? If not, is there an alternative solution ?

Thanks in advance!

Upvotes: 2

Views: 1376

Answers (2)

Jamilah Foucher
Jamilah Foucher

Reputation: 21

I used jobs.query (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query), it was less complicated than jobs.insert. You can use a normal BigQuery SQL query directly under the POST json key "query".

projectId = "PROJECT_ID";
{
"query": "INSERT INTO DATASET_NAME.TABLE_NAME (COLUMN_NAME0, COLUMN_NAME1) VALUES('value0_here', 'value1_here');",
  "location": "LOCATION",
  "useLegacySql": false
}

Upvotes: 1

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173190

You can use Job.insert API to issue DML query to UPDATE specific row(s)

Please note: BigQuery is not designed for transactions - so read carefully about quotas and pricing

Upvotes: 3

Related Questions