Database Reference
In-Depth Information
"bqjob_r239fa6e7bb78440_000001408ce3e8f2_1"
}
}
]
}
Jobs.query() and Jobs.getQueryResults() RPCs
The Jobs.query() and Jobs.getQueryResults() APIs are used to
run queries and get the results of queries, respectively. These APIs are
covered in depth in Chapter 7, so we defer discussion of them until that
chapter.
BigQuery API Tour
There is an old puzzle called the “knight's tour” in chess: How can you move
a knight around a chessboard such that it hits every square exactly once?
Listing 5.3 shows the “knight's tour” of the BigQuery API—it runs through
each API method in each collection once, leaving the end state the same as
when you started. This puts all the APIs in context, lets you see how they
work, and shows how to call them from Python.
Listing 5.3 : A Knight's tour of the BigQuery API (tour.py)
# Python imports
import io
import json
import sys
import time
# Google APIs imports
from apiclient.discovery import build
from apiclient.errors import HttpError
from apiclient.http import MediaIoBaseUpload
# BigQuery e2e imports
import auth
## Runs through each BigQuery API request.
def run_tour(service, project_id):
print 'Running BigQuery API tour'
projects = service.projects()
datasets = service.datasets()
tables = service.tables()
 
 
Search WWH ::




Custom Search