Database Reference
In-Depth Information
cached = BACKGROUND_QUERIES[int(index)]
result = bigquery.jobs().insert(
projectId=PROJECT_ID,
body=cached.query_job).execute()
logging.info(str(result))
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('ok')
# Helper function to construct query job
configurations.
def _dashboard_query_job(
query,
table,
# Results cached for rendering go in the dashboard
dataset.
dataset='dashboard'):
return {
'configuration': {
'query': {
'query': query,
'destinationTable': {
'projectId': PROJECT_ID,
'datasetId': dataset,
'tableId': table
},
'writeDisposition': 'WRITE_TRUNCATE'
}
}
}
# List of queries that need to be cached in the
dasboard dataset.
BACKGROUND_QUERIES = [
BackgroundQuery(
_dashboard_query_job(
'''SELECT
SEC_TO_TIMESTAMP(INTEGER(TIMESTAMP_TO_SEC(ts)/
60) * 60)
Search WWH ::




Custom Search