getQueryResults method

Future<GetQueryResultsResponse> getQueryResults(
  1. String projectId,
  2. String jobId, {
  3. String? location,
  4. int? maxResults,
  5. String? pageToken,
  6. String? startIndex,
  7. int? timeoutMs,
  8. String? $fields,
})

Retrieves the results of a query job.

Request parameters:

projectId - [Required] Project ID of the query job

jobId - [Required] Job ID of the query job

location - The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.

maxResults - Maximum number of results to read

pageToken - Page token, returned by a previous call, to request the next page of results

startIndex - Zero-based index of the starting row

timeoutMs - How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false

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

Completes with a GetQueryResultsResponse.

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<GetQueryResultsResponse> getQueryResults(
  core.String projectId,
  core.String jobId, {
  core.String? location,
  core.int? maxResults,
  core.String? pageToken,
  core.String? startIndex,
  core.int? timeoutMs,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (location != null) 'location': [location],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (startIndex != null) 'startIndex': [startIndex],
    if (timeoutMs != null) 'timeoutMs': ['${timeoutMs}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'projects/' +
      commons.escapeVariable('$projectId') +
      '/queries/' +
      commons.escapeVariable('$jobId');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return GetQueryResultsResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}