Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any method to validate a query in the BigQuery api

I'm using Google APIs Client Library for php, and I'd like to be able to validate a query before send it to execution. Are there any method in the Google BigQuery API to validate a query (Get the text in the red box).

I couldn't find it. I was reading this section https://cloud.google.com/bigquery/docs/reference/v2/jobs/query

BigQuery validator

like image 230
Emilio Gort Avatar asked Jun 25 '15 21:06

Emilio Gort


People also ask

How do you see the query of a table in BigQuery?

Select BigQuery under which you will find Scheduled queries option,click on that. In the filter tab you can enter the keywords and get the required query of the table.

What two types of queries can BigQuery perform?

BigQuery supports two types of queries: Interactive queries. Batch queries.

What is dry run in BigQuery?

When you run a query in the bq command-line tool, you can use the --dry_run flag to estimate the number of bytes read by the query. You can also use the dryRun parameter when submitting a query job using the API or client libraries. Dry runs do not use query slots, and you are not charged for performing a dry run.


1 Answers

Setting the dryRun parameter to true on a jobs.query request should allow you to validate a query. Dry run queries don't catch all errors, but they can catch quite a few. The query validator in the web UI uses dry run queries to provide real-time errors as shown in your screenshot.

Docs for the dryRun parameter:

[Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run.

like image 109
Danny Kitt Avatar answered Sep 21 '22 02:09

Danny Kitt