getQueryResults method

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

RPC to get the results of a query job.

Request parameters:

projectId - Required. Project ID of the query job. Value must have pattern ^\[^/\]+$.

jobId - Required. Job ID of the query job. Value must have pattern ^\[^/\]+$.

formatOptions_useInt64Timestamp - Optional. Output timestamp as usec int64. Default is false.

location - The geographic location of the job. You must specify the location to run the job for the following scenarios: - If the location to run a job is not in the us or the eu multi-regional location - If the job's location is in a single region (for example, us-central1) For more information, see 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 - Optional: Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. By default, this limit is 10 seconds (10,000 milliseconds). If the query is complete, the jobComplete field in the response is true. If the query has not yet completed, jobComplete is false. You can request a longer timeout period in the timeoutMs field. However, the call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. If jobComplete is false, you can continue to wait for the query to complete by calling the getQueryResults method until the jobComplete field in the getQueryResults response is true.

$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.bool? formatOptions_useInt64Timestamp,
  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 (formatOptions_useInt64Timestamp != null)
      'formatOptions.useInt64Timestamp': [
        '${formatOptions_useInt64Timestamp}'
      ],
    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/' +
      core.Uri.encodeFull('$projectId') +
      '/queries/' +
      core.Uri.encodeFull('$jobId');

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