Google BigQuery v2 API - Class BigQueryResults (3.2.0)

Stay organized with collections Save and categorize content based on your preferences.
public sealed class BigQueryResults : IEnumerable<BigQueryRow>, IEnumerable

Reference documentation and code samples for the Google BigQuery v2 API class BigQueryResults.

The results of a completed query.

Inheritance

Object > BigQueryResults

Namespace

Google.Cloud.BigQuery.V2

Assembly

Google.Cloud.BigQuery.V2.dll

Constructors

BigQueryResults(BigQueryClient, GetQueryResultsResponse, TableReference, GetQueryResultsOptions)

public BigQueryResults(BigQueryClient client, GetQueryResultsResponse response, TableReference tableReference, GetQueryResultsOptions options)

Constructs a new set of results.

Parameters
NameDescription
clientBigQueryClient

The client to use for further operations. Must not be null.

responseGoogle.Apis.Bigquery.v2.Data.GetQueryResultsResponse

The response to a GetQueryResults API call. Must not be null.

tableReferenceGoogle.Apis.Bigquery.v2.Data.TableReference

A reference to the table containing the results. May be null. (For example, script queries don't store results in tables.)

optionsGetQueryResultsOptions

Options to use when fetching results. May be null.

Remarks

This is public to allow tests to construct instances for production code to consume; production code should not normally construct instances itself.

Properties

JobReference

public JobReference JobReference { get; }

The reference to the query job.

Property Value
TypeDescription
Google.Apis.Bigquery.v2.Data.JobReference

NumDmlAffectedRows

public long? NumDmlAffectedRows { get; }

The total number of rows affected by a DML statement, or null for non-DML results.

Property Value
TypeDescription
Nullable<Int64>

Schema

public TableSchema Schema { get; }

The schema of the query.

Property Value
TypeDescription
Google.Apis.Bigquery.v2.Data.TableSchema

TableReference

public TableReference TableReference { get; }

The reference to the table containing the query results. May be null. (For example, script queries don't store results in tables.)

Property Value
TypeDescription
Google.Apis.Bigquery.v2.Data.TableReference

TotalRows

public ulong? TotalRows { get; }

The total number of rows in the results, or null if the query results do not provide a row count.

Property Value
TypeDescription
Nullable<UInt64>

Methods

GetEnumerator()

public IEnumerator<BigQueryRow> GetEnumerator()

Returns an iterator over the query results.

Returns
TypeDescription
IEnumerator<BigQueryRow>

An iterator over the query results.

GetRowsAsync()

public IAsyncEnumerable<BigQueryRow> GetRowsAsync()

Returns an asynchronous sequence of rows from this set of results.

Returns
TypeDescription
IAsyncEnumerable<BigQueryRow>

An asynchronous sequence of rows from this set of results.

Remarks

This method exists rather than making the class implement IAsyncEnumerable<T> to avoid ambiguity.

ReadPage(Int32)

public BigQueryPage ReadPage(int pageSize)

Eagerly fetches a set of rows, up to the specified count, providing a page of results with a next page token if more results are available. This is typically used within web applications, where the next page token is propagated to the client along with the results, so that the next page can be retrieved in another request.

Parameter
NameDescription
pageSizeInt32

The maximum number of rows to retrieve. Must be positive.

Returns
TypeDescription
BigQueryPage

An in-memory result set of at most the given number of rows.

ReadPageAsync(Int32, CancellationToken)

public async Task<BigQueryPage> ReadPageAsync(int pageSize, CancellationToken cancellationToken = default(CancellationToken))

Asynchronously but eagerly fetches a set of rows, up to the specified count, providing a page of results with a next page token if more results are available. This is typically used within web applications, where the next page token is propagated to the client along with the results, so that the next page can be retrieved in another request.

Parameters
NameDescription
pageSizeInt32

The maximum number of rows to retrieve. Must be positive.

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
Task<BigQueryPage>

A task representing the asynchronous operation. When complete, the result is an in-memory result set of at most the given number of rows.

ThrowOnAnyError()

public BigQueryResults ThrowOnAnyError()

Returns this if the job has no errors, or throws an exception containing the errors. A job may have errors but still contain useful information.

Returns
TypeDescription
BigQueryResults

this if the job has no errors.

Exceptions
TypeDescription
GoogleApiException

The job has errors.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

IEnumerator IEnumerable.GetEnumerator()

Returns an iterator over the query results.

Returns
TypeDescription
IEnumerator

An iterator over the query results.