Vibhor Jain
Vibhor Jain

Reputation: 1476

BQ API :: query vs insert ('query') job

I'm looking at BQ API docs: https://cloud.google.com/bigquery/docs/reference/rest/v2/ and would like to confirm what's the difference between

Jobs: query POST https://www.googleapis.com/bigquery/v2/projects/projectId/queries

Jobs: insert (with a 'query' job) POST https://www.googleapis.com/bigquery/v2/projects/projectId/jobs

Both seem to be serving same purpose, querying a table with provided SQL statement...

Did I understand correctly that:

Thanks a lot!

Cheers!

Upvotes: 3

Views: 2388

Answers (1)

Vibhor Jain
Vibhor Jain

Reputation: 1476

so my understanding was correct:

Jobs: query POSTone return the query results (data) immediately in it's response body (sort of synchronous / blocking process)

Jobs: insert (with a 'query' job) POST just creates a query job in the backend, (sort of async / non-blocking process) and later we still have to execute either Jobs: getQueryResults (if we got jobId) or Tabledata: list in order to fetch query results (data).. both of which I believe work in same way (sync / blocking) as Jobs: query

Upvotes: 1

Related Questions