Database Reference
In-Depth Information
json.dumps(resp))
return resp
def read_cache(tabledata, cache_id):
rows = []
resp = {'pageToken': None}
while 'pageToken' in resp:
resp = tabledata.list(
projectId=auth.PROJECT_ID,
datasetId=CACHE_DATASET,
tableId=cache_id,
pageToken=resp['pageToken'],
maxResults=10000).execute()
rows.extend([[cell.get('v') for cell in
row.get('f')]
for row in resp.get('rows', [])])
return rows
def update_top_apps(jobs):
return cache_query(
jobs,
'''
SELECT
running.name AppName,
AVG(running.memory.total) MemUsage,
COUNT(running.name) Running'''
# FROM (TABLE_DATE_RANGE(logs.device_,
# DATE_ADD(CURRENT_TIMESTAMP(),
-1, 'DAY'),
# CURRENT_TIMESTAMP()))
# Daily tables are protected so we substitute a sample
table.
'''
FROM [bigquery-e2e:ch11.sample_device_log]'''
# Drop the where clause since the sample table is
static.
# WHERE
# (TIMESTAMP_TO_SEC(CURRENT_TIMESTAMP()) -
# TIMESTAMP_TO_SEC(ts)) < 60 * 60 * 6
Search WWH ::




Custom Search