Google-cloud-php: BigQuery: runQuery returns 404 NotFound on dryRun

Created on 21 Feb 2018  路  2Comments  路  Source: googleapis/google-cloud-php

So I tried running a query with dryRun set to true and I got a 404 Not Found Error.

My Code

$sql = "<Some Simple SQL>";
$options = ['maxResults' => 10, 'startIndex' => 0];
$jobConfig = $client->query($sql)->dryRun(true);
$results = $client->runQuery($jobConfig, $options);

Response

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not found: Job <my-job-id>"
   }
  ],
  "code": 404,
  "message": "Not found: Job <my-job-id>"
 }
}

Am I doing something wrong here?

All I'm trying to do is mimic the following with this API.
https://cloud.google.com/bigquery/docs/best-practices-costs#performing_a_dry_run

bigquery question

All 2 comments

Thank you for the report @taka-oyama. The method which will allow you to look up dry run related bits of data (such as projected total bytes processed) will be BigQueryClient::startQuery(). The issue with runQuery is that it attempts to fetch rows for you automatically, even though they do not exist for a dry run scenario.

To help make this clearer, I will add some documentation regarding where dry run can be used and have runQuery throw an exception if a dry run is configured.

Thank you. startQuery() works as expected!

Was this page helpful?
0 / 5 - 0 ratings