In GCP, Big Query editor, https://console.cloud.google.com/bigquery, I can execute my query like this:
#standardSQL
SELECT COUNT(*) AS num_downloads
FROM `the-psf.pypi.file_downloads`
WHERE file.project = 'pytest'
-- Only query the last 30 days of history
AND DATE(timestamp)
BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
AND CURRENT_DATE()
But when I try to use the REST API to execute the query, i.e. go to https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query and click 'Try it', and put this in the request body:
{
"query": " #standardSQL
SELECT COUNT(*) AS num_downloads
FROM `the-psf.pypi.file_downloads`
WHERE file.project = 'pytest'
-- Only query the last 30 days of history
AND DATE(timestamp)
BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
AND CURRENT_DATE()"
}
I get error like "Select an underlined section to see more details. You have invalid or missing required parameter values above." So how can I fix the problem in order to use the Query REST API?
queryfield. Review the required fields. cloud.google.com/bigquery/docs/reference/rest/v2/jobs/… Example:"kind":"bigquery#queryRequest","useLegacySql":false,"query":YOUR_QUERY- John Hanley