Database Reference
In-Depth Information
Chapter 5
Talking to the BigQuery API
The last chapter described the principal abstractions used by BigQuery:
projects, datasets, tables, and jobs. This chapter shows you how those
concepts map into interaction with the BigQuery service. We introduce the
BigQuery REST API by describing the raw underlying HTTP format. We
show that there is no magic involved: The BigQuery service is just a server
that accepts HTTP requests and returns JSON responses. After reading this
chapter, you should understand the API model and be able to interact with
the service.
If you do not plan to write code to access BigQuery—that is, you plan to use
only tools such as bq or the BigQuery web interface to use BigQuery—you
may want to skip this chapter. That said, understanding how the BigQuery
API works may make your interaction with BigQuery tools make more sense
because those tools use the BigQuery API underneath the covers.
Introduction to Google APIs
Google has a number of externally facing APIs for accessing Google products:
the Maps API, a Google+ API, several AdSense APIs, and more. You can
see a list of them all in the Google Cloud Console. (Go to
https://console.developers.google.com . click the name of a
project, then click the APIs & auth tab.) BigQuery is just one of these APIs
and shares a lot in common with other Google web services.
This section gives information about the basics of accessing any of the
REST-based Google web APIs, with a focus on how these operations work in
BigQuery. We demonstrate raw access using the UNIX curl command so
that you can see what actually happens at the API level. When an example
requires stringing together multiple commands, we use Python code instead,
which will likely be closer to the code you'd write to solve tasks yourself. If
you're familiar with other web APIs, you should feel comfortable quickly.
We run all of the commands in this chapter in the bigquery-e2e project,
but if you try them out yourself, you should substitute your own project ID.
Search WWH ::




Custom Search