Database Reference
In-Depth Information
>>> import pprint
>>> project_id = 'bigquery-e2e'
>>> service = auth.build_bq_client()
>>> response = service.jobs().query(
projectId=project_id ,
body={'query': 'SELECT 17'}).execute()
>>> pprint.pprint(response)
{u'cacheHit': True,
u'jobComplete': True,
u'jobReference': {u'jobId':
u'job_86V_-s5k_EyN3Fuk8ym03nItDrM',
u'projectId': u'bigquery-e2e'},
u'kind': u'bigquery#queryResponse',
u'rows': [{u'f': [{u'v': u'17'}]}],
u'schema': {u'fields': [{u'mode': u'NULLABLE',
u'name': u'f0_',
u'type': u'INTEGER'}]},
u'totalBytesProcessed': u'0',
u'totalRows': u'1'}
The
corresponding
commands
to
just
start
the
query
using
Jobs.insert() is not much more complex:
>>> import time
>>> job_id = 'job_%d' % int(time.time() * 1000)
>>> response = service.jobs().insert(
projectId=project_id ,
body={'configuration': {'query': {'query':
'SELECT 17'}} ,
'jobReference': {'jobId': job_id ,
'projectId': project_id}}
).execute()
>>> pprint.pprint(response)
{u'configuration': {
u'query': {
u'createDisposition': u'CREATE_IF_NEEDED',
u'destinationTable': {
u'datasetId':
u'_0e32b38e1117b2fcea992287c138bd53acfff7cc',
Search WWH ::




Custom Search