public sealed class BigQueryResults : IEnumerable<BigQueryRow>, IEnumerable
The results of a completed query.
Namespace
Google.Cloud.BigQuery.V2Assembly
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 | |
---|---|
Name | Description |
client | BigQueryClient The client to use for further operations. Must not be null. |
response | Google.Apis.Bigquery.v2.Data.GetQueryResultsResponse The response to a GetQueryResults API call. Must not be null. |
tableReference | Google.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.) |
options | GetQueryResultsOptions Options to use when fetching results. May be null. |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
Nullable<Int64> |
Schema
public TableSchema Schema { get; }
The schema of the query.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
Nullable<UInt64> |
Methods
GetEnumerator()
public IEnumerator<BigQueryRow> GetEnumerator()
Returns an iterator over the query results.
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
IAsyncEnumerable<BigQueryRow> | An asynchronous sequence of rows from this set of results. |
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 | |
---|---|
Name | Description |
pageSize | Int32 The maximum number of rows to retrieve. Must be positive. |
Returns | |
---|---|
Type | Description |
BigQueryPage | An in-memory result set of at most the given number of rows. |
ReadPageAsync(Int32, CancellationToken)
public 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 | |
---|---|
Name | Description |
pageSize | Int32 The maximum number of rows to retrieve. Must be positive. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
BigQueryResults |
|
Exceptions | |
---|---|
Type | Description |
GoogleApiException | The job has errors. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns an iterator over the query results.
Returns | |
---|---|
Type | Description |
IEnumerator | An iterator over the query results. |