validate method

Future<ValidateResponse> validate(
  1. String projectId,
  2. String location, {
  3. String? query,
  4. String? $fields,
})

Validates a GoogleSQL query for Cloud Dataflow syntax.

Will always confirm the given query parses correctly, and if able to look up schema information from DataCatalog, will validate that the query analyzes properly as well.

Request parameters:

projectId - Required. The ID of the Cloud Platform project that the job belongs to.

location - The regional endpoint to which to direct the request.

query - The sql query to validate.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ValidateResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ValidateResponse> validate(
  core.String projectId,
  core.String location, {
  core.String? query,
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if (query != null) 'query': [query],
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'v1b3/projects/' +
      commons.escapeVariable('$projectId') +
      '/locations/' +
      commons.escapeVariable('$location') +
      '/sql:validate';

  final _response = await _requester.request(
    _url,
    'GET',
    queryParams: _queryParams,
  );
  return ValidateResponse.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}