Database Reference
In-Depth Information
batch_priority=False):
'''Run a Query Job and print the results.
query: text of query to run.
response_handler: function that is used to
process results.
job_id: optional job id to provide to BigQuery.
allow_large_results: whether to allow query results
larger than
128 MB.
destination_table: if present, the destination
table to write
the query results to.
batch_priority: whether to run the query at
batch priority
'''
query_config = {
'query': query,
'allowLargeResults': allow_large_results
}
if not job_id:
# If the caller did not specify a job id,
generate one
# based on the current time.
job_id = 'job_%d' % int(time.time() * 1000)
if destination_table:
# If this is run multiple times, truncate the
table and
# replace it with the new results.
query_config['writeDisposition'] =
'WRITE_TRUNCATE'
query_config['destinationTable'] =
destination_table
query_config['allowLargeResults'] =
allow_large_results
if batch_priority:
query_config['priority'] = 'BATCH'
job_ref = {'projectId': self.project_id}
if job_id:
Search WWH ::




Custom Search