Google BigQuery v2 API - Class BigQueryClient (3.10.0)

public abstract class BigQueryClient : IDisposable

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

Abstract class providing operations for Google Cloud BigQuery.

Inheritance

object > BigQueryClient

Implements

IDisposable

Derived Types

Namespace

Google.Cloud.BigQuery.V2

Assembly

Google.Cloud.BigQuery.V2.dll

Remarks

This abstract class is provided to enable testability while permitting additional operations to be added in the future. See Create(string, GoogleCredential) and CreateAsync(string, GoogleCredential) to construct instances; alternatively, you can construct a BigQueryClientImpl directly from a BigqueryService.

All instance methods declared in this class are virtual, with an implementation which simply throws NotImplementedException. All these methods are overridden in BigQueryClientImpl.

This class implements IDisposable; however, the Dispose() method only requires calling if many short-lived instances of BigQueryClient are being created. Most code would be expected to create a single BigQueryClient instance, and use this instance throughout the lifetime of the application. In this case, Dispose need not be called.

Properties

DefaultLocation

public virtual string DefaultLocation { get; }

The default location to use for all operations where locations can be specified, such as dataset and job creation.

Property Value
Type Description
string

PrettyPrint

public virtual bool PrettyPrint { get; }

Determines whether or not responses should be formatted with whitespace for readability.

Property Value
Type Description
bool

ProjectId

public virtual string ProjectId { get; }

The ID of the project this client operates on. All operations that require a project to be specified implicitly supply this ID.

Property Value
Type Description
string

Service

public virtual BigqueryService Service { get; }

The underlying BigQuery service object used by this client.

Property Value
Type Description
BigqueryService
Remarks

The BigQueryClient class only provides convenience operations built on top of an existing service object. Any more complex operations which are not supported by this wrapper may wish to use the same service object as the wrapper, in order to take advantage of its configuration (for authentication, application naming etc).

Methods

CancelJob(JobReference, CancelJobOptions)

public virtual BigQueryJob CancelJob(JobReference jobReference, CancelJobOptions options = null)

Cancels the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The final state of the job.

Example

See CancelJob for an example using an alternative overload.

CancelJob(string, CancelJobOptions)

public virtual BigQueryJob CancelJob(string jobId, CancelJobOptions options = null)

Cancels the specified job within this client's project. This method just creates a JobReference and delegates to CancelJob(JobReference, CancelJobOptions).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The final state of the job.

Example
// Just an example of a job: extracting data to Google Cloud Storage.
BigQueryClient client = BigQueryClient.Create(projectId);
string destinationUri = $"gs://{bucket}/{objectName}";

// Start the job running...
BigQueryJob job = client.CreateExtractJob(projectId, datasetId, tableId, destinationUri);

// Now cancel it by ID. (Equivalent to calling job.Cancel().)
string jobId = job.Reference.JobId;
BigQueryJob canceledJob = client.CancelJob(jobId);
Console.WriteLine(canceledJob.State);

CancelJob(string, string, CancelJobOptions)

public virtual BigQueryJob CancelJob(string projectId, string jobId, CancelJobOptions options = null)

Cancels the specified job. This method just creates a JobReference and delegates to CancelJob(JobReference, CancelJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The final state of the job.

Example

See CancelJob for an example using an alternative overload.

CancelJobAsync(JobReference, CancelJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CancelJobAsync(JobReference jobReference, CancelJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously cancels the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the final state of the job.

Example

See CancelJob for a synchronous example.

CancelJobAsync(string, CancelJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CancelJobAsync(string jobId, CancelJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously cancels the specified job within this client's project. This method just creates a JobReference and delegates to CancelJobAsync(JobReference, CancelJobOptions, CancellationToken).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the final state of the job.

Example

See CancelJob for a synchronous example.

CancelJobAsync(string, string, CancelJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CancelJobAsync(string projectId, string jobId, CancelJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously cancels the specified job. This method just creates a JobReference and delegates to CancelJobAsync(JobReference, CancelJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options CancelJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the final state of the job.

Example

See CancelJob for a synchronous example.

ClearDatasetLabels(DatasetReference, ModifyLabelsOptions)

public virtual IDictionary<string, string> ClearDatasetLabels(DatasetReference datasetReference, ModifyLabelsOptions options = null)

Clears all labels on the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
IDictionarystringstring

A dictionary with the labels on the dataset before they were cleared.

Example

See ClearDatasetLabels for an example using an alternative overload.

ClearDatasetLabels(string, ModifyLabelsOptions)

public virtual IDictionary<string, string> ClearDatasetLabels(string datasetId, ModifyLabelsOptions options = null)

Clears all labels on the specified dataset within this client's project. This method just creates a DatasetReference and delegates to ClearDatasetLabels(DatasetReference, ModifyLabelsOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
IDictionarystringstring

A dictionary with the labels on the dataset before they were cleared.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

IDictionary<string, string> previousLabels = client.ClearDatasetLabels(datasetId);
Console.WriteLine("Previous labels:");
foreach (KeyValuePair<string, string> label in previousLabels)
{
    Console.WriteLine($"Name: {label.Key}; Value: {label.Value}");
}

ClearDatasetLabels(string, string, ModifyLabelsOptions)

public virtual IDictionary<string, string> ClearDatasetLabels(string projectId, string datasetId, ModifyLabelsOptions options = null)

Clears all labels on the specified dataset. This method just creates a DatasetReference and delegates to ClearDatasetLabels(DatasetReference, ModifyLabelsOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
IDictionarystringstring

A dictionary with the labels on the dataset before they were cleared.

Example

See ClearDatasetLabels for an example using an alternative overload.

ClearDatasetLabelsAsync(DatasetReference, ModifyLabelsOptions, CancellationToken)

public virtual Task<IDictionary<string, string>> ClearDatasetLabelsAsync(DatasetReference datasetReference, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously clears all labels on the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskIDictionarystringstring

A task representing the asynchronous operation. When complete, the result is a dictionary with the labels on the dataset before they were cleared.

Example

See ClearDatasetLabels for a synchronous example.

ClearDatasetLabelsAsync(string, ModifyLabelsOptions, CancellationToken)

public virtual Task<IDictionary<string, string>> ClearDatasetLabelsAsync(string datasetId, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously clears all labels on the specified dataset within this client's project. This method just creates a DatasetReference and delegates to ClearDatasetLabelsAsync(DatasetReference, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskIDictionarystringstring

A task representing the asynchronous operation. When complete, the result is a dictionary with the labels on the dataset before they were cleared.

Example

See ClearDatasetLabels for a synchronous example.

ClearDatasetLabelsAsync(string, string, ModifyLabelsOptions, CancellationToken)

public virtual Task<IDictionary<string, string>> ClearDatasetLabelsAsync(string projectId, string datasetId, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously clears all labels on the specified dataset. This method just creates a DatasetReference and delegates to ClearDatasetLabelsAsync(DatasetReference, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options ModifyLabelsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskIDictionarystringstring

A task representing the asynchronous operation. When complete, the result is a dictionary with the labels on the dataset before they were cleared.

Example

See ClearDatasetLabels for a synchronous example.

Create(string, GoogleCredential)

public static BigQueryClient Create(string projectId, GoogleCredential credential = null)

Synchronously creates a BigQueryClient, using application default credentials if no credentials are specified.

Parameters
Name Description
projectId string

The ID of the project containing the BigQuery data. Must not be null.

credential GoogleCredential

Optional GoogleCredential.

Returns
Type Description
BigQueryClient

The created BigQueryClient.

Remarks

If the supplied credentials support scoping, the following scopes are specified, overwriting any previously-specified scopes.

If you require a different set of scopes, please create and scope the credential, then use BigQueryClientBuilder, specify the Credential and ProjectId properties, then call Build() to create the client.

CreateAsync(string, GoogleCredential)

public static Task<BigQueryClient> CreateAsync(string projectId, GoogleCredential credential = null)

Asynchronously creates a BigQueryClient, using application default credentials if no credentials are specified.

Parameters
Name Description
projectId string

The ID of the project containing the BigQuery data. Must not be null.

credential GoogleCredential

Optional GoogleCredential.

Returns
Type Description
TaskBigQueryClient

The task representing the created BigQueryClient.

Remarks

If the supplied credentials support scoping, the following scopes are specified, overwriting any previously-specified scopes.

If you require a different set of scopes, please create and scope the credential, then use BigQueryClientBuilder, specify the Credential and ProjectId properties, then call Build() to create the client.

CreateCopyJob(TableReference, TableReference, CreateCopyJobOptions)

public virtual BigQueryJob CreateCopyJob(TableReference source, TableReference destination, CreateCopyJobOptions options = null)

Creates a job to copy one table to another. This method creates a single-element array and delegates to CreateCopyJob(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions).

Parameters
Name Description
source TableReference

The source table to copy. Must not be null.

destination TableReference

The destination to copy to. Must not be null.

options CreateCopyJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the copy operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableReference sourceTableReference = client.GetTableReference(datasetId, sourceTableId);
TableReference destinationTableReference = client.GetTableReference(datasetId, destinationTableId);

BigQueryJob job = client.CreateCopyJob(sourceTableReference, destinationTableReference)
    .PollUntilCompleted();
// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}

CreateCopyJob(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions)

public virtual BigQueryJob CreateCopyJob(IEnumerable<TableReference> sources, TableReference destination, CreateCopyJobOptions options = null)

Creates a job to copy data from at least one table to another.

Parameters
Name Description
sources IEnumerableTableReference

The source tables to copy. Must not be null or empty.

destination TableReference

The destination to copy to. Must not be null.

options CreateCopyJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the copy operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example

See CreateCopyJob for an example using an alternative overload.

CreateCopyJobAsync(TableReference, TableReference, CreateCopyJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateCopyJobAsync(TableReference source, TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to copy one table to another. This method creates a single-element array and delegates to CreateCopyJobAsync(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions, CancellationToken).

Parameters
Name Description
source TableReference

The source table to copy. Must not be null.

destination TableReference

The destination to copy to. Must not be null.

options CreateCopyJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the copy operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableReference sourceTableReference = client.GetTableReference(datasetId, sourceTableId);
TableReference destinationTableReference = client.GetTableReference(datasetId, destinationTableId);

BigQueryJob job = await client.CreateCopyJobAsync(sourceTableReference, destinationTableReference);
job = await job.PollUntilCompletedAsync();

// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}

CreateCopyJobAsync(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateCopyJobAsync(IEnumerable<TableReference> sources, TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to copy data from at least one table to another.

Parameters
Name Description
sources IEnumerableTableReference

The source tables to copy. Must not be null or empty.

destination TableReference

The destination to copy to. Must not be null.

options CreateCopyJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the copy operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example

See CreateCopyJob for an example using an alternative overload.

CreateDataset(DatasetReference, Dataset, CreateDatasetOptions)

public virtual BigQueryDataset CreateDataset(DatasetReference datasetReference, Dataset resource = null, CreateDatasetOptions options = null)

Creates the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See CreateDataset for an example using an alternative overload.

CreateDataset(string, Dataset, CreateDatasetOptions)

public virtual BigQueryDataset CreateDataset(string datasetId, Dataset resource = null, CreateDatasetOptions options = null)

Creates the specified dataset within this client's project. This method just creates a DatasetReference and delegates to CreateDataset(DatasetReference, Dataset, CreateDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryDataset dataset = client.CreateDataset(datasetId);
// Now populate tables in the dataset...

CreateDataset(string, string, Dataset, CreateDatasetOptions)

public virtual BigQueryDataset CreateDataset(string projectId, string datasetId, Dataset resource = null, CreateDatasetOptions options = null)

Creates the specified dataset. This method just creates a DatasetReference and delegates to CreateDataset(DatasetReference, Dataset, CreateDatasetOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See CreateDataset for an example using an alternative overload.

CreateDatasetAsync(DatasetReference, Dataset, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> CreateDatasetAsync(DatasetReference datasetReference, Dataset resource = null, CreateDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See CreateDataset for an example using an alternative overload.

CreateDatasetAsync(string, Dataset, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> CreateDatasetAsync(string datasetId, Dataset resource = null, CreateDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified dataset within this client's project. This method just creates a DatasetReference and delegates to CreateDatasetAsync(DatasetReference, Dataset, CreateDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
BigQueryDataset dataset = await client.CreateDatasetAsync(datasetId);
// Now populate tables in the dataset...

CreateDatasetAsync(string, string, Dataset, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> CreateDatasetAsync(string projectId, string datasetId, Dataset resource = null, CreateDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified dataset. This method just creates a DatasetReference and delegates to CreateDatasetAsync(DatasetReference, Dataset, CreateDatasetOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

options CreateDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the created dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See CreateDataset for an example using an alternative overload.

CreateExtractJob(TableReference, IEnumerable<string>, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(TableReference tableReference, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example

See CreateExtractJob for an example using an alternative overload.

CreateExtractJob(TableReference, string, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(TableReference tableReference, string destinationUri, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table to Google Cloud Storage. This method just creates a single-element array and delegates to CreateExtractJob(TableReference, IEnumerable<string>, CreateExtractJobOptions). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example

See CreateExtractJob for an example using an alternative overload.

CreateExtractJob(string, string, IEnumerable<string>, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(string datasetId, string tableId, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs. This method just creates a TableReference and delegates to CreateExtractJob(TableReference, IEnumerable<string>, CreateExtractJobOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example

See CreateExtractJob for an example using an alternative overload.

CreateExtractJob(string, string, string, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(string datasetId, string tableId, string destinationUri, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table within this client's project to Google Cloud Storage. This method just creates a TableReference and delegates to CreateExtractJob(TableReference, string, CreateExtractJobOptions). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example

See CreateExtractJob for an example using an alternative overload.

CreateExtractJob(string, string, string, IEnumerable<string>, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(string projectId, string datasetId, string tableId, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs. This method just creates a TableReference and delegates to CreateExtractJob(TableReference, IEnumerable<string>, CreateExtractJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example

See CreateExtractJob for an example using an alternative overload.

CreateExtractJob(string, string, string, string, CreateExtractJobOptions)

public virtual BigQueryJob CreateExtractJob(string projectId, string datasetId, string tableId, string destinationUri, CreateExtractJobOptions options = null)

Creates a job to extract data from the specified BigQuery table to Google Cloud Storage. This method just creates a TableReference and delegates to CreateExtractJob(TableReference, string, CreateExtractJobOptions). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
string destinationUri = $"gs://{bucket}/{objectName}";

BigQueryJob job = client.CreateExtractJob(projectId, datasetId, tableId, destinationUri)
    .PollUntilCompleted();
// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}
else
{
    StorageClient storageClient = StorageClient.Create();
    var obj = storageClient.GetObject(bucket, objectName);
    Console.WriteLine($"Extracted file size: {obj.Size}");
}

CreateExtractJobAsync(TableReference, IEnumerable<string>, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(TableReference tableReference, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example

See CreateExtractJobAsync for an example using an alternative overload.

CreateExtractJobAsync(TableReference, string, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(TableReference tableReference, string destinationUri, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table to Google Cloud Storage. This method just creates a single-element array and delegates to CreateExtractJobAsync(TableReference, IEnumerable<string>, CreateExtractJobOptions, CancellationToken). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example

See CreateExtractJobAsync for an example using an alternative overload.

CreateExtractJobAsync(string, string, IEnumerable<string>, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(string datasetId, string tableId, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs. This method just creates a TableReference and delegates to CreateExtractJobAsync(TableReference, IEnumerable<string>, CreateExtractJobOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example

See CreateExtractJobAsync for an example using an alternative overload.

CreateExtractJobAsync(string, string, string, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(string datasetId, string tableId, string destinationUri, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table within this client's project to Google Cloud Storage. This method just creates a TableReference and delegates to CreateExtractJobAsync(TableReference, string, CreateExtractJobOptions, CancellationToken). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example

See CreateExtractJobAsync for an example using an alternative overload.

CreateExtractJobAsync(string, string, string, IEnumerable<string>, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(string projectId, string datasetId, string tableId, IEnumerable<string> destinationUris, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table to Google Cloud Storage. See the BigQuery documentation for more information on extract jobs. This method just creates a TableReference and delegates to CreateExtractJobAsync(TableReference, IEnumerable<string>, CreateExtractJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example

See CreateExtractJobAsync for an example using an alternative overload.

CreateExtractJobAsync(string, string, string, string, CreateExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateExtractJobAsync(string projectId, string datasetId, string tableId, string destinationUri, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract data from the specified BigQuery table to Google Cloud Storage. This method just creates a TableReference and delegates to CreateExtractJobAsync(TableReference, string, CreateExtractJobOptions, CancellationToken). See the BigQuery documentation for more information on extract jobs.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null.

options CreateExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
string destinationUri = $"gs://{bucket}/{objectName}";

BigQueryJob job = await client.CreateExtractJobAsync(projectId, datasetId, tableId, destinationUri);
job = await job.PollUntilCompletedAsync();
// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}
else
{
    StorageClient storageClient = StorageClient.Create();
    var obj = storageClient.GetObject(bucket, objectName);
    Console.WriteLine($"Extracted file size: {obj.Size}");
}

CreateJsonSerializersSettings()

public static JsonSerializerSettings CreateJsonSerializersSettings()

Creates a set of Newtonsoft.Json.JsonSerializerSettings suitable for specifying in BigqueryService construction. The settings have Json.NET date parsing detection disabled.

Returns
Type Description
Newtonsoft.Json.JsonSerializerSettings

A suitable set of settings.

CreateLoadJob(IEnumerable<string>, TableReference, TableSchema, CreateLoadJobOptions)

public virtual BigQueryJob CreateLoadJob(IEnumerable<string> sourceUris, TableReference destination, TableSchema schema, CreateLoadJobOptions options = null)

Creates a job to load data from at least one Google Cloud Storage file to a BigQuery table.

Parameters
Name Description
sourceUris IEnumerablestring

The Google Cloud Storage URIs of the files to load. Must not be null or empty.

destination TableReference

The destination table to write data to. Must not be null.

schema TableSchema

The schema for the table. May be null if the load operation does not require a schema, such as if the table already exists, the data is being loaded from a Google Cloud Datastore backup, or if the options are set to autodetect the schema.

options CreateLoadJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the load operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example

See CreateLoadJob for an example using an alternative overload.

CreateLoadJob(string, TableReference, TableSchema, CreateLoadJobOptions)

public virtual BigQueryJob CreateLoadJob(string sourceUri, TableReference destination, TableSchema schema, CreateLoadJobOptions options = null)

Creates a job to load data from a Google Cloud Storage file to a BigQuery table. This method creates a single-element array and delegates to CreateLoadJob(IEnumerable<string>, TableReference, TableSchema, CreateLoadJobOptions).

Parameters
Name Description
sourceUri string

The Google Cloud Storage URI of the file to load. Must not be null.

destination TableReference

The destination table to write data to. Must not be null.

schema TableSchema

The schema for the table. May be null if the load operation does not require a schema, such as if the table already exists, the data is being loaded from a Google Cloud Datastore backup, or if the options are set to autodetect the schema.

options CreateLoadJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the load operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

// First extract the data to Google Cloud Storage...
// (This is just a convenient way of getting data into Google Cloud Storage
// to demonstrate a load job. If you only wanted to copy a table,
// you'd create a copy job instead.)
BigQueryTable table = client.GetTable(datasetId, originalTableId);
table.CreateExtractJob(objectUri).PollUntilCompleted().ThrowOnAnyError();

TableReference newTableReference = client.GetTableReference(datasetId, newTableId);

// Then load it back again, with the same schema.
// The extracted file will contain a header row: we need to skip it when loading.
CreateLoadJobOptions options = new CreateLoadJobOptions
{
    SkipLeadingRows = 1
};
BigQueryJob job = client.CreateLoadJob(objectUri, newTableReference, table.Schema, options).PollUntilCompleted();

// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}

CreateLoadJobAsync(IEnumerable<string>, TableReference, TableSchema, CreateLoadJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateLoadJobAsync(IEnumerable<string> sourceUris, TableReference destination, TableSchema schema, CreateLoadJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to load data from at least one Google Cloud Storage file to a BigQuery table.

Parameters
Name Description
sourceUris IEnumerablestring

The Google Cloud Storage URIs of the files to load. Must not be null or empty.

destination TableReference

The destination table to write data to. Must not be null.

schema TableSchema

The schema for the table. May be null if the load operation does not require a schema, such as if the table already exists, the data is being loaded from a Google Cloud Datastore backup, or if the options are set to autodetect the schema.

options CreateLoadJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the load operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example

See CreateLoadJob for an example using an alternative overload.

CreateLoadJobAsync(string, TableReference, TableSchema, CreateLoadJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateLoadJobAsync(string sourceUri, TableReference destination, TableSchema schema, CreateLoadJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to load data from a Google Cloud Storage file to a BigQuery table. This method creates a single-element array and delegates to CreateLoadJobAsync(IEnumerable<string>, TableReference, TableSchema, CreateLoadJobOptions, CancellationToken).

Parameters
Name Description
sourceUri string

The Google Cloud Storage URI of the file to load. Must not be null.

destination TableReference

The destination table to write data to. Must not be null.

schema TableSchema

The schema for the table. May be null if the load operation does not require a schema, such as if the table already exists, the data is being loaded from a Google Cloud Datastore backup, or if the options are set to autodetect the schema.

options CreateLoadJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the load operation.

Remarks

To avoid confusion between source and destination tables, overloads are not provided that take the individual components of table references. Instead, use GetTableReference(string, string) or GetTableReference(string, string, string) to create table references.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

// First extract the data to Google Cloud Storage...
// (This is just a convenient way of getting data into Google Cloud Storage
// to demonstrate a load job. If you only wanted to copy a table,
// you'd create a copy job instead.)
BigQueryTable table = await client.GetTableAsync(datasetId, originalTableId);
var extractJob = await table.CreateExtractJobAsync(objectUri);
extractJob = (await extractJob.PollUntilCompletedAsync()).ThrowOnAnyError();

TableReference newTableReference = client.GetTableReference(datasetId, newTableId);

// Then load it back again, with the same schema.
// The extracted file will contain a header row: we need to skip it when loading.
CreateLoadJobOptions options = new CreateLoadJobOptions
{
    SkipLeadingRows = 1
};
BigQueryJob job = await client.CreateLoadJobAsync(objectUri, newTableReference, table.Schema, options);
await job.PollUntilCompletedAsync();

// If there are any errors, display them.
if (job.Status.ErrorResult != null)
{
    foreach (ErrorProto error in job.Status.Errors)
    {
        Console.WriteLine(error.Message);
    }
}

CreateModelExtractJob(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(ModelReference modelReference, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJob(ModelReference, string, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(ModelReference modelReference, string destinationUri, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJob(string, string, IEnumerable<string>, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(string datasetId, string modelId, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJob(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJob(string, string, string, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(string datasetId, string modelId, string destinationUri, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJob(ModelReference, string, CreateModelExtractJobOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJob(string, string, string, IEnumerable<string>, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(string projectId, string datasetId, string modelId, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJob(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJob(string, string, string, string, CreateModelExtractJobOptions)

public virtual BigQueryJob CreateModelExtractJob(string projectId, string datasetId, string modelId, string destinationUri, CreateModelExtractJobOptions options = null)

Creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJob(ModelReference, string, CreateModelExtractJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The job created for the extract operation.

CreateModelExtractJobAsync(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(ModelReference modelReference, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateModelExtractJobAsync(ModelReference, string, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(ModelReference modelReference, string destinationUri, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateModelExtractJobAsync(string, string, IEnumerable<string>, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(string datasetId, string modelId, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJobAsync(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateModelExtractJobAsync(string, string, string, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(string datasetId, string modelId, string destinationUri, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJobAsync(ModelReference, string, CreateModelExtractJobOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateModelExtractJobAsync(string, string, string, IEnumerable<string>, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(string projectId, string datasetId, string modelId, IEnumerable<string> destinationUris, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJobAsync(ModelReference, IEnumerable<string>, CreateModelExtractJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUris IEnumerablestring

The Google Cloud Storage URIs (possibly including a wildcard) to extract the model to. Must not be null or empty.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateModelExtractJobAsync(string, string, string, string, CreateModelExtractJobOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateModelExtractJobAsync(string projectId, string datasetId, string modelId, string destinationUri, CreateModelExtractJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job to extract the specified BigQuery model to Google Cloud Storage. See the BigQuery documentation for more information on model extract jobs. This method just creates a ModelReference and delegates to CreateModelExtractJobAsync(ModelReference, string, CreateModelExtractJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

destinationUri string

The Google Cloud Storage URI (possibly including a wildcard) to extract the model to. Must not be null.

options CreateModelExtractJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the job created for the extract operation.

CreateQueryJob(string, IEnumerable<BigQueryParameter>, QueryOptions)

public virtual BigQueryJob CreateQueryJob(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions options = null)

Creates a job for a SQL query.

Parameters
Name Description
sql string

The SQL query. Must not be null.

parameters IEnumerableBigQueryParameter

The parameters for the query. May be null, which is equivalent to specifying an empty list of parameters. Must not contain null elements.

options QueryOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The query job created. Use GetQueryResults(JobReference, GetQueryResultsOptions) to retrieve the results of the query.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, historyTableId);
TableReference destination = client.GetTableReference(datasetId, queryTableId);
// If the destination table is not specified, the results will be stored in
// a temporary table.
BigQueryJob job = client.CreateQueryJob(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    null, // No parameters
    new QueryOptions { DestinationTable = destination });

// Wait for the job to complete.
job.PollUntilCompleted();

// Then we can fetch the results, either via the job or by accessing
// the destination table.
BigQueryResults result = client.GetQueryResults(job.Reference);
foreach (BigQueryRow row in result)
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
}

CreateQueryJobAsync(string, IEnumerable<BigQueryParameter>, QueryOptions, CancellationToken)

public virtual Task<BigQueryJob> CreateQueryJobAsync(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates a job for a SQL query.

Parameters
Name Description
sql string

The SQL query. Must not be null.

parameters IEnumerableBigQueryParameter

The parameters for the query. May be null, which is equivalent to specifying an empty list of parameters. Must not contain null elements.

options QueryOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the query job created. Use GetQueryResultsAsync(JobReference, GetQueryResultsOptions, CancellationToken) to retrieve the results of the query.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
BigQueryTable table = await client.GetTableAsync(datasetId, historyTableId);
TableReference destination = client.GetTableReference(datasetId, queryTableId);
// If the destination table is not specified, the results will be stored in
// a temporary table.
BigQueryJob job = await client.CreateQueryJobAsync(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    null, // No parameters
    new QueryOptions { DestinationTable = destination });

// Wait for the job to complete.
await job.PollUntilCompletedAsync();

// Then we can fetch the results, either via the job or by accessing
// the destination table.
BigQueryResults result = await client.GetQueryResultsAsync(job.Reference);
await result.GetRowsAsync().ForEachAsync(row =>
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
});

CreateRoutine(RoutineReference, Routine, CreateRoutineOptions)

public virtual BigQueryRoutine CreateRoutine(RoutineReference routineReference, Routine resource, CreateRoutineOptions options = null)

Creates the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The newly created routine.

CreateRoutine(string, string, Routine, CreateRoutineOptions)

public virtual BigQueryRoutine CreateRoutine(string datasetId, string routineId, Routine resource, CreateRoutineOptions options = null)

Creates the specified routine within this client's project. This method just creates a RoutineReference and delegates to CreateRoutine(RoutineReference, Routine, CreateRoutineOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The newly created routine.

CreateRoutine(string, string, string, Routine, CreateRoutineOptions)

public virtual BigQueryRoutine CreateRoutine(string projectId, string datasetId, string routineId, Routine resource, CreateRoutineOptions options = null)

Creates the specified routine. This method just creates a RoutineReference and delegates to CreateRoutine(RoutineReference, Routine, CreateRoutineOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The newly created routine.

CreateRoutineAsync(RoutineReference, Routine, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> CreateRoutineAsync(RoutineReference routineReference, Routine resource, CreateRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the newly created routine.

CreateRoutineAsync(string, string, Routine, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> CreateRoutineAsync(string datasetId, string routineId, Routine resource, CreateRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified routine within this client's project. This method just creates a RoutineReference and delegates to CreateRoutineAsync(RoutineReference, Routine, CreateRoutineOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the newly created routine.

CreateRoutineAsync(string, string, string, Routine, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> CreateRoutineAsync(string projectId, string datasetId, string routineId, Routine resource, CreateRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified routine. This method just creates a RoutineReference and delegates to CreateRoutineAsync(RoutineReference, Routine, CreateRoutineOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the newly created routine.

CreateTable(TableReference, Table, CreateTableOptions)

public virtual BigQueryTable CreateTable(TableReference tableReference, Table resource, CreateTableOptions options = null)

Creates the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example

See CreateTable for an example using an alternative overload.

CreateTable(TableReference, TableSchema, CreateTableOptions)

public virtual BigQueryTable CreateTable(TableReference tableReference, TableSchema schema, CreateTableOptions options = null)

Creates the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example

See CreateTable for an example using an alternative overload.

CreateTable(string, string, Table, CreateTableOptions)

public virtual BigQueryTable CreateTable(string datasetId, string tableId, Table resource, CreateTableOptions options = null)

Creates the specified table within this client's project. This method just creates a TableReference and delegates to CreateTable(TableReference, Table, CreateTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example

See CreateTable for an example using an alternative overload.

CreateTable(string, string, TableSchema, CreateTableOptions)

public virtual BigQueryTable CreateTable(string datasetId, string tableId, TableSchema schema, CreateTableOptions options = null)

Creates the specified table within this client's project. This method just creates a TableReference and delegates to CreateTable(TableReference, TableSchema, CreateTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableSchema schema = new TableSchemaBuilder
{
    { "from_player", BigQueryDbType.String },
    { "to_player", BigQueryDbType.String },
    { "message", BigQueryDbType.String }
}.Build();
BigQueryTable table = client.CreateTable(datasetId, tableId, schema);
// Now populate the table with data...

CreateTable(string, string, string, Table, CreateTableOptions)

public virtual BigQueryTable CreateTable(string projectId, string datasetId, string tableId, Table resource, CreateTableOptions options = null)

Creates the specified table. This method just creates a TableReference and delegates to CreateTable(TableReference, Table, CreateTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example

See CreateTable for an example using an alternative overload.

CreateTable(string, string, string, TableSchema, CreateTableOptions)

public virtual BigQueryTable CreateTable(string projectId, string datasetId, string tableId, TableSchema schema, CreateTableOptions options = null)

Creates the specified table. This method just creates a TableReference and delegates to CreateTable(TableReference, TableSchema, CreateTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The newly created table.

Example

See CreateTable for an example using an alternative overload.

CreateTableAsync(TableReference, Table, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(TableReference tableReference, Table resource, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example

See CreateTableAsync for an example using an alternative overload.

CreateTableAsync(TableReference, TableSchema, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(TableReference tableReference, TableSchema schema, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example

See CreateTableAsync for an example using an alternative overload.

CreateTableAsync(string, string, Table, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(string datasetId, string tableId, Table resource, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table within this client's project. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, Table, CreateTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example

See CreateTableAsync for an example using an alternative overload.

CreateTableAsync(string, string, TableSchema, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(string datasetId, string tableId, TableSchema schema, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table within this client's project. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, TableSchema, CreateTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
TableSchema schema = new TableSchemaBuilder
{
    { "from_player", BigQueryDbType.String },
    { "to_player", BigQueryDbType.String },
    { "message", BigQueryDbType.String }
}.Build();
BigQueryTable table = await client.CreateTableAsync(datasetId, tableId, schema);
// Now populate the table with data...

CreateTableAsync(string, string, string, Table, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(string projectId, string datasetId, string tableId, Table resource, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, Table, CreateTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example

See CreateTableAsync for an example using an alternative overload.

CreateTableAsync(string, string, string, TableSchema, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> CreateTableAsync(string projectId, string datasetId, string tableId, TableSchema schema, CreateTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously creates the specified table. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, TableSchema, CreateTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

options CreateTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the newly created table.

Example

See CreateTableAsync for an example using an alternative overload.

DeleteDataset(DatasetReference, DeleteDatasetOptions)

public virtual void DeleteDataset(DatasetReference datasetReference, DeleteDatasetOptions options = null)

Deletes the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example

See DeleteDataset for an example using an alternative overload.

DeleteDataset(string, DeleteDatasetOptions)

public virtual void DeleteDataset(string datasetId, DeleteDatasetOptions options = null)

Deletes the specified dataset within this client's project. This method just creates a DatasetReference and delegates to DeleteDataset(DatasetReference, DeleteDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
client.DeleteDataset(datasetId);

DeleteDataset(string, string, DeleteDatasetOptions)

public virtual void DeleteDataset(string projectId, string datasetId, DeleteDatasetOptions options = null)

Deletes the specified dataset. This method just creates a DatasetReference and delegates to DeleteDataset(DatasetReference, DeleteDatasetOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example

See DeleteDataset for an example using an alternative overload.

DeleteDatasetAsync(DatasetReference, DeleteDatasetOptions, CancellationToken)

public virtual Task DeleteDatasetAsync(DatasetReference datasetReference, DeleteDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example

See DeleteDatasetAsync for an example using an alternative overload.

DeleteDatasetAsync(string, DeleteDatasetOptions, CancellationToken)

public virtual Task DeleteDatasetAsync(string datasetId, DeleteDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified dataset within this client's project. This method just creates a DatasetReference and delegates to DeleteDatasetAsync(DatasetReference, DeleteDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
await client.DeleteDatasetAsync(datasetId);

DeleteDatasetAsync(string, string, DeleteDatasetOptions, CancellationToken)

public virtual Task DeleteDatasetAsync(string projectId, string datasetId, DeleteDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified dataset. This method just creates a DatasetReference and delegates to DeleteDatasetAsync(DatasetReference, DeleteDatasetOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options DeleteDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example

See DeleteDatasetAsync for an example using an alternative overload.

DeleteJob(JobReference, DeleteJobOptions)

public virtual void DeleteJob(JobReference jobReference, DeleteJobOptions options = null)

Deletes the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteJob(string, DeleteJobOptions)

public virtual void DeleteJob(string jobId, DeleteJobOptions options = null)

Deletes the specified job within this client's project. This method just creates a JobReference and delegates to DeleteJob(JobReference, DeleteJobOptions).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteJob(string, string, DeleteJobOptions)

public virtual void DeleteJob(string projectId, string jobId, DeleteJobOptions options = null)

Deletes the specified job. This method just creates a JobReference and delegates to DeleteJob(JobReference, DeleteJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteJobAsync(JobReference, DeleteJobOptions, CancellationToken)

public virtual Task DeleteJobAsync(JobReference jobReference, DeleteJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteJobAsync(string, DeleteJobOptions, CancellationToken)

public virtual Task DeleteJobAsync(string jobId, DeleteJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified job within this client's project. This method just creates a JobReference and delegates to DeleteJobAsync(JobReference, DeleteJobOptions, CancellationToken).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteJobAsync(string, string, DeleteJobOptions, CancellationToken)

public virtual Task DeleteJobAsync(string projectId, string jobId, DeleteJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified job. This method just creates a JobReference and delegates to DeleteJobAsync(JobReference, DeleteJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options DeleteJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteModel(ModelReference, DeleteModelOptions)

public virtual void DeleteModel(ModelReference modelReference, DeleteModelOptions options = null)

Deletes the specified model.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteModel(string, string, DeleteModelOptions)

public virtual void DeleteModel(string datasetId, string modelId, DeleteModelOptions options = null)

Deletes the specified model within this client's project. This method just creates a ModelReference and delegates to DeleteModel(ModelReference, DeleteModelOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteModel(string, string, string, DeleteModelOptions)

public virtual void DeleteModel(string projectId, string datasetId, string modelId, DeleteModelOptions options = null)

Deletes the specified model. This method just creates a ModelReference and delegates to DeleteModel(ModelReference, DeleteModelOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteModelAsync(ModelReference, DeleteModelOptions, CancellationToken)

public virtual Task DeleteModelAsync(ModelReference modelReference, DeleteModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified model.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteModelAsync(string, string, DeleteModelOptions, CancellationToken)

public virtual Task DeleteModelAsync(string datasetId, string modelId, DeleteModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified model within this client's project. This method just creates a ModelReference and delegates to DeleteModelAsync(ModelReference, DeleteModelOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteModelAsync(string, string, string, DeleteModelOptions, CancellationToken)

public virtual Task DeleteModelAsync(string projectId, string datasetId, string modelId, DeleteModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified model. This method just creates a ModelReference and delegates to DeleteModelAsync(ModelReference, DeleteModelOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options DeleteModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteRoutine(RoutineReference, DeleteRoutineOptions)

public virtual void DeleteRoutine(RoutineReference routineReference, DeleteRoutineOptions options = null)

Deletes the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteRoutine(string, string, DeleteRoutineOptions)

public virtual void DeleteRoutine(string datasetId, string routineId, DeleteRoutineOptions options = null)

Deletes the specified routine within this client's project. This method just creates a RoutineReference and delegates to DeleteRoutine(RoutineReference, DeleteRoutineOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteRoutine(string, string, string, DeleteRoutineOptions)

public virtual void DeleteRoutine(string projectId, string datasetId, string routineId, DeleteRoutineOptions options = null)

Deletes the specified routine. This method just creates a RoutineReference and delegates to DeleteRoutine(RoutineReference, DeleteRoutineOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

DeleteRoutineAsync(RoutineReference, DeleteRoutineOptions, CancellationToken)

public virtual Task DeleteRoutineAsync(RoutineReference routineReference, DeleteRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteRoutineAsync(string, string, DeleteRoutineOptions, CancellationToken)

public virtual Task DeleteRoutineAsync(string datasetId, string routineId, DeleteRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified routine within this client's project. This method just creates a RoutineReference and delegates to DeleteRoutineAsync(RoutineReference, DeleteRoutineOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteRoutineAsync(string, string, string, DeleteRoutineOptions, CancellationToken)

public virtual Task DeleteRoutineAsync(string projectId, string datasetId, string routineId, DeleteRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified routine. This method just creates a RoutineReference and delegates to DeleteRoutineAsync(RoutineReference, DeleteRoutineOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options DeleteRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

DeleteTable(TableReference, DeleteTableOptions)

public virtual void DeleteTable(TableReference tableReference, DeleteTableOptions options = null)

Deletes the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example

See DeleteTable for an example using an alternative overload.

DeleteTable(string, string, DeleteTableOptions)

public virtual void DeleteTable(string datasetId, string tableId, DeleteTableOptions options = null)

Deletes the specified table within this client's project. This method just creates a TableReference and delegates to DeleteTable(TableReference, DeleteTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
client.DeleteTable(datasetId, tableId);

DeleteTable(string, string, string, DeleteTableOptions)

public virtual void DeleteTable(string projectId, string datasetId, string tableId, DeleteTableOptions options = null)

Deletes the specified table. This method just creates a TableReference and delegates to DeleteTable(TableReference, DeleteTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Example

See DeleteTable for an example using an alternative overload.

DeleteTableAsync(TableReference, DeleteTableOptions, CancellationToken)

public virtual Task DeleteTableAsync(TableReference tableReference, DeleteTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example

See DeleteTableAsync for an example using an alternative overload.

DeleteTableAsync(string, string, DeleteTableOptions, CancellationToken)

public virtual Task DeleteTableAsync(string datasetId, string tableId, DeleteTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified table within this client's project. This method just creates a TableReference and delegates to DeleteTableAsync(TableReference, DeleteTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
await client.DeleteTableAsync(datasetId, tableId);

DeleteTableAsync(string, string, string, DeleteTableOptions, CancellationToken)

public virtual Task DeleteTableAsync(string projectId, string datasetId, string tableId, DeleteTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously deletes the specified table. This method just creates a TableReference and delegates to DeleteTableAsync(TableReference, DeleteTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options DeleteTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.

Example

See DeleteTableAsync for an example using an alternative overload.

Dispose()

public virtual void Dispose()

Dispose of this instance. See the BigQueryClient remarks on when this should be called.

ExecuteQuery(string, IEnumerable<BigQueryParameter>, QueryOptions, GetQueryResultsOptions)

public virtual BigQueryResults ExecuteQuery(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions queryOptions = null, GetQueryResultsOptions resultsOptions = null)

Executes a query.

Parameters
Name Description
sql string

The SQL query. Must not be null.

parameters IEnumerableBigQueryParameter

The parameters for the query. May be null, which is equivalent to specifying an empty list of parameters. Must not contain null elements.

queryOptions QueryOptions

The options for the query. May be null, in which case defaults will be supplied.

resultsOptions GetQueryResultsOptions

The options for retrieving query results. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryResults

The result of the query.

Remarks

This method will only return when the query has completed. It simply delegates to CreateQueryJob(string, IEnumerable<BigQueryParameter>, QueryOptions) and then GetQueryResults(GetQueryResultsOptions).

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, historyTableId);
BigQueryResults result = client.ExecuteQuery(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    parameters: null);
foreach (BigQueryRow row in result)
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
}

ExecuteQueryAsync(string, IEnumerable<BigQueryParameter>, QueryOptions, GetQueryResultsOptions, CancellationToken)

public virtual Task<BigQueryResults> ExecuteQueryAsync(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions queryOptions = null, GetQueryResultsOptions resultsOptions = null, CancellationToken cancellationToken = default)

Asynchronously executes a query.

Parameters
Name Description
sql string

The SQL query. Must not be null.

parameters IEnumerableBigQueryParameter

The parameters for the query. May be null, which is equivalent to specifying an empty list of parameters. Must not contain null elements.

queryOptions QueryOptions

The options for the query. May be null, in which case defaults will be supplied.

resultsOptions GetQueryResultsOptions

The options for retrieving query results. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryResults

A task representing the asynchronous operation. When complete, the result is the BigQueryResults representing the query.

Remarks

The task returned by this method will only complete when the query has completed. This method simply delegates to CreateQueryJobAsync(string, IEnumerable<BigQueryParameter>, QueryOptions, CancellationToken) and then GetQueryResultsAsync(GetQueryResultsOptions, CancellationToken).

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
BigQueryTable table = await client.GetTableAsync(datasetId, historyTableId);
BigQueryResults result = await client.ExecuteQueryAsync(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    parameters: null);
await result.GetRowsAsync().ForEachAsync(row =>
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
});

GetBigQueryServiceAccountEmail(ProjectReference, GetBigQueryServiceAccountEmailOptions)

public virtual string GetBigQueryServiceAccountEmail(ProjectReference projectReference, GetBigQueryServiceAccountEmailOptions options = null)

Retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service.

Parameters
Name Description
projectReference ProjectReference

A fully-qualified identifier for the project. Must not be null.

options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
string

The email address of the service account.

Example

See GetBigQueryServiceAccountEmail for an example using an alternative overload.

GetBigQueryServiceAccountEmail(GetBigQueryServiceAccountEmailOptions)

public virtual string GetBigQueryServiceAccountEmail(GetBigQueryServiceAccountEmailOptions options = null)

Retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service. This method just creates a ProjectReference and delegates to GetBigQueryServiceAccountEmail(ProjectReference, GetBigQueryServiceAccountEmailOptions).

Parameter
Name Description
options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
string

The email address of the service account.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
string email = client.GetBigQueryServiceAccountEmail();
Console.WriteLine(email);

GetBigQueryServiceAccountEmail(string, GetBigQueryServiceAccountEmailOptions)

public virtual string GetBigQueryServiceAccountEmail(string projectId, GetBigQueryServiceAccountEmailOptions options = null)

Retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service. This method just creates a ProjectReference and delegates to GetBigQueryServiceAccountEmail(ProjectReference, GetBigQueryServiceAccountEmailOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
string

The email address of the service account.

Example

See GetBigQueryServiceAccountEmail for an example using an alternative overload.

GetBigQueryServiceAccountEmailAsync(ProjectReference, GetBigQueryServiceAccountEmailOptions, CancellationToken)

public virtual Task<string> GetBigQueryServiceAccountEmailAsync(ProjectReference projectReference, GetBigQueryServiceAccountEmailOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service.

Parameters
Name Description
projectReference ProjectReference

A fully-qualified identifier for the project. Must not be null.

options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Taskstring

A task representing the asynchronous operation. When complete, the result is the email address of the service account.

Example

See GetBigQueryServiceAccountEmail for a synchronous example.

GetBigQueryServiceAccountEmailAsync(GetBigQueryServiceAccountEmailOptions, CancellationToken)

public virtual Task<string> GetBigQueryServiceAccountEmailAsync(GetBigQueryServiceAccountEmailOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service. This method just creates a ProjectReference and delegates to GetBigQueryServiceAccountEmailAsync(ProjectReference, GetBigQueryServiceAccountEmailOptions, CancellationToken).

Parameters
Name Description
options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Taskstring

A task representing the asynchronous operation. When complete, the result is the email address of the service account.

Example

See GetBigQueryServiceAccountEmail for a synchronous example.

GetBigQueryServiceAccountEmailAsync(string, GetBigQueryServiceAccountEmailOptions, CancellationToken)

public virtual Task<string> GetBigQueryServiceAccountEmailAsync(string projectId, GetBigQueryServiceAccountEmailOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the service account email address that Google Cloud BigQuery uses for operations on other services such as the Google Cloud Key Management Service. This method just creates a ProjectReference and delegates to GetBigQueryServiceAccountEmailAsync(ProjectReference, GetBigQueryServiceAccountEmailOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

options GetBigQueryServiceAccountEmailOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
Taskstring

A task representing the asynchronous operation. When complete, the result is the email address of the service account.

Example

See GetBigQueryServiceAccountEmail for a synchronous example.

GetDataset(DatasetReference, GetDatasetOptions)

public virtual BigQueryDataset GetDataset(DatasetReference datasetReference, GetDatasetOptions options = null)

Retrieves the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The requested dataset.

Example

See GetDataset for an example using an alternative overload.

GetDataset(string, GetDatasetOptions)

public virtual BigQueryDataset GetDataset(string datasetId, GetDatasetOptions options = null)

Retrieves the specified dataset within this client's project. This method just creates a DatasetReference and delegates to GetDataset(DatasetReference, GetDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The requested dataset.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryDataset dataset = client.GetDataset(datasetId);
Console.WriteLine(dataset.FullyQualifiedId);

GetDataset(string, string, GetDatasetOptions)

public virtual BigQueryDataset GetDataset(string projectId, string datasetId, GetDatasetOptions options = null)

Retrieves the specified dataset. This method just creates a DatasetReference and delegates to GetDataset(DatasetReference, GetDatasetOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The requested dataset.

Example

See GetDataset for an example using an alternative overload.

GetDatasetAsync(DatasetReference, GetDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetDatasetAsync(DatasetReference datasetReference, GetDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the requested dataset.

Example

See GetDataset for a synchronous example.

GetDatasetAsync(string, GetDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetDatasetAsync(string datasetId, GetDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified dataset within this client's project. This method just creates a DatasetReference and delegates to GetDatasetAsync(DatasetReference, GetDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the requested dataset.

Example

See GetDataset for a synchronous example.

GetDatasetAsync(string, string, GetDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetDatasetAsync(string projectId, string datasetId, GetDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified dataset. This method just creates a DatasetReference and delegates to GetDatasetAsync(DatasetReference, GetDatasetOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

options GetDatasetOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the requested dataset.

Example

See GetDataset for a synchronous example.

GetDatasetReference(string)

public DatasetReference GetDatasetReference(string datasetId)

Creates a DatasetReference from the given dataset ID, using this client's project ID.

Parameter
Name Description
datasetId string

The dataset ID. Must not be null.

Returns
Type Description
DatasetReference

A DatasetReference representing the requested dataset.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
DatasetReference reference = client.GetDatasetReference("dataset");
// ProjectId is defaulted from the client in this overload
Console.WriteLine(reference.ProjectId);

GetDatasetReference(string, string)

public DatasetReference GetDatasetReference(string projectId, string datasetId)

Creates a DatasetReference from the given project ID and dataset ID.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

Returns
Type Description
DatasetReference

A DatasetReference representing the requested dataset.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
DatasetReference reference = client.GetDatasetReference("other-project", "dataset");
// ProjectId is as specified in the call, not the client's project
Console.WriteLine(reference.ProjectId);

GetJob(JobReference, GetJobOptions)

public virtual BigQueryJob GetJob(JobReference jobReference, GetJobOptions options = null)

Retrieves the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The retrieved job.

Example

See GetJob for an example using an alternative overload.

GetJob(string, GetJobOptions)

public virtual BigQueryJob GetJob(string jobId, GetJobOptions options = null)

Retrieves the specified job within this client's project. This method just creates a JobReference and delegates to GetJob(JobReference, GetJobOptions).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The retrieved job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryJob job = client.GetJob(jobId);
Console.WriteLine(job.State);

GetJob(string, string, GetJobOptions)

public virtual BigQueryJob GetJob(string projectId, string jobId, GetJobOptions options = null)

Retrieves the specified job. This method just creates a JobReference and delegates to GetJob(JobReference, GetJobOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The retrieved job.

Example

See GetJob for an example using an alternative overload.

GetJobAsync(JobReference, GetJobOptions, CancellationToken)

public virtual Task<BigQueryJob> GetJobAsync(JobReference jobReference, GetJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the retrieved job.

Example

See GetJob for a synchronous example.

GetJobAsync(string, GetJobOptions, CancellationToken)

public virtual Task<BigQueryJob> GetJobAsync(string jobId, GetJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified job within this client's project. This method just creates a JobReference and delegates to GetJobAsync(JobReference, GetJobOptions, CancellationToken).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the retrieved job.

Example

See GetJob for a synchronous example.

GetJobAsync(string, string, GetJobOptions, CancellationToken)

public virtual Task<BigQueryJob> GetJobAsync(string projectId, string jobId, GetJobOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified job. This method just creates a JobReference and delegates to GetJobAsync(JobReference, GetJobOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options GetJobOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryJob

A task representing the asynchronous operation. When complete, the result is the retrieved job.

Example

See GetJob for a synchronous example.

GetJobReference(string)

public JobReference GetJobReference(string jobId)

Creates a JobReference from the given job ID, using this client's project ID and default location.

Parameter
Name Description
jobId string

The job ID. Must not be null.

Returns
Type Description
JobReference

A JobReference representing the requested job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
JobReference reference = client.GetJobReference("job");
// ProjectId is defaulted from the client in this overload
Console.WriteLine(reference.ProjectId);

GetJobReference(string, string)

public JobReference GetJobReference(string projectId, string jobId)

Creates a JobReference from the given project ID and job ID, using this client's default location.

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

Returns
Type Description
JobReference

A JobReference representing the requested job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
JobReference reference = client.GetJobReference("other-project", "job");
// ProjectId is as specified in the call, not the client's project
Console.WriteLine(reference.ProjectId);

GetJobReference(string, string, string)

public JobReference GetJobReference(string projectId, string jobId, string location)

Creates a JobReference from the given project ID, job ID and location.

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

location string

The location. May be null.

Returns
Type Description
JobReference

A JobReference representing the requested job.

GetModel(ModelReference, GetModelOptions)

public virtual BigQueryModel GetModel(ModelReference modelReference, GetModelOptions options = null)

Retrieves the specified model.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryModel

The requested model.

GetModel(string, string, GetModelOptions)

public virtual BigQueryModel GetModel(string datasetId, string modelId, GetModelOptions options = null)

Retrieves the specified model within this client's project. This method just creates a ModelReference and delegates to GetModel(ModelReference, GetModelOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryModel

The requested model.

GetModel(string, string, string, GetModelOptions)

public virtual BigQueryModel GetModel(string projectId, string datasetId, string modelId, GetModelOptions options = null)

Retrieves the specified model. This method just creates a ModelReference and delegates to GetModel(ModelReference, GetModelOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryModel

The requested model.

GetModelAsync(ModelReference, GetModelOptions, CancellationToken)

public virtual Task<BigQueryModel> GetModelAsync(ModelReference modelReference, GetModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified model.

Parameters
Name Description
modelReference ModelReference

A fully-qualified identifier for the model. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryModel

A task representing the asynchronous operation. When complete, the result is the requested model.

GetModelAsync(string, string, GetModelOptions, CancellationToken)

public virtual Task<BigQueryModel> GetModelAsync(string datasetId, string modelId, GetModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified model within this client's project. This method just creates a ModelReference and delegates to GetModelAsync(ModelReference, GetModelOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryModel

A task representing the asynchronous operation. When complete, the result is the requested model.

GetModelAsync(string, string, string, GetModelOptions, CancellationToken)

public virtual Task<BigQueryModel> GetModelAsync(string projectId, string datasetId, string modelId, GetModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified model. This method just creates a ModelReference and delegates to GetModelAsync(ModelReference, GetModelOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

options GetModelOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryModel

A task representing the asynchronous operation. When complete, the result is the requested model.

GetModelReference(string, string)

public ModelReference GetModelReference(string datasetId, string modelId)

Creates a ModelReference from the given dataset ID and model ID, using this client's project ID.

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

Returns
Type Description
ModelReference

A ModelReference representing the requested model.

GetModelReference(string, string, string)

public ModelReference GetModelReference(string projectId, string datasetId, string modelId)

Creates a ModelReference from the given project ID, dataset ID and model ID.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

Returns
Type Description
ModelReference

A ModelReference representing the requested model.

GetOrCreateDataset(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions)

public virtual BigQueryDataset GetOrCreateDataset(DatasetReference datasetReference, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null)

Attempts to fetch the specified dataset, creating it if it doesn't exist.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See GetOrCreateDataset for an example using an alternative overload.

GetOrCreateDataset(string, Dataset, GetDatasetOptions, CreateDatasetOptions)

public virtual BigQueryDataset GetOrCreateDataset(string datasetId, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null)

Attempts to fetch the specified dataset within this client's project, creating it if it doesn't exist. This method just creates a DatasetReference and delegates to GetOrCreateDataset(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// If the dataset isn't found, it will be created.
BigQueryDataset dataset = client.GetOrCreateDataset(datasetId);
// Now populate tables in the dataset...

GetOrCreateDataset(string, string, Dataset, GetDatasetOptions, CreateDatasetOptions)

public virtual BigQueryDataset GetOrCreateDataset(string projectId, string datasetId, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null)

Attempts to fetch the specified dataset, creating it if it doesn't exist. This method just creates a DatasetReference and delegates to GetOrCreateDataset(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryDataset

The existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See GetOrCreateDataset for an example using an alternative overload.

GetOrCreateDatasetAsync(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetOrCreateDatasetAsync(DatasetReference datasetReference, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified dataset, creating it if it doesn't exist.

Parameters
Name Description
datasetReference DatasetReference

A fully-qualified identifier for the dataset. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See GetOrCreateDataset for an example using an alternative overload.

GetOrCreateDatasetAsync(string, Dataset, GetDatasetOptions, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetOrCreateDatasetAsync(string datasetId, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified dataset within this client's project, creating it if it doesn't exist. This method just creates a DatasetReference and delegates to GetOrCreateDatasetAsync(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
// If the dataset isn't found, it will be created.
BigQueryDataset dataset = await client.GetOrCreateDatasetAsync(datasetId);
// Now populate tables in the dataset...

GetOrCreateDatasetAsync(string, string, Dataset, GetDatasetOptions, CreateDatasetOptions, CancellationToken)

public virtual Task<BigQueryDataset> GetOrCreateDatasetAsync(string projectId, string datasetId, Dataset resource = null, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified dataset, creating it if it doesn't exist. This method just creates a DatasetReference and delegates to GetOrCreateDatasetAsync(DatasetReference, Dataset, GetDatasetOptions, CreateDatasetOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the creation. May be null in which case default values will be used.

getOptions GetDatasetOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateDatasetOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryDataset

A task representing the asynchronous operation. When complete, the result is the existing or new dataset.

Remarks

If resourceDatasetReference is specified, then it must be the same as the DatasetReference obtained from the other parameters.

Example

See GetOrCreateDataset for an example using an alternative overload.

GetOrCreateRoutine(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions)

public virtual BigQueryRoutine GetOrCreateRoutine(RoutineReference routineReference, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null)

Attempts to fetch the specified routine, creating it if it doesn't exist.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The existing or new routine.

GetOrCreateRoutine(string, string, Routine, GetRoutineOptions, CreateRoutineOptions)

public virtual BigQueryRoutine GetOrCreateRoutine(string datasetId, string routineId, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null)

Attempts to fetch the specified routine within this client's project, creating it if it doesn't exist. This method just creates a RoutineReference and delegates to GetOrCreateRoutine(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The existing or new routine.

GetOrCreateRoutine(string, string, string, Routine, GetRoutineOptions, CreateRoutineOptions)

public virtual BigQueryRoutine GetOrCreateRoutine(string projectId, string datasetId, string routineId, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null)

Attempts to fetch the specified routine, creating it if it doesn't exist. This method just creates a RoutineReference and delegates to GetOrCreateRoutine(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The existing or new routine.

GetOrCreateRoutineAsync(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetOrCreateRoutineAsync(RoutineReference routineReference, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified routine, creating it if it doesn't exist.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the existing or new routine.

GetOrCreateRoutineAsync(string, string, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetOrCreateRoutineAsync(string datasetId, string routineId, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified routine within this client's project, creating it if it doesn't exist. This method just creates a RoutineReference and delegates to GetOrCreateRoutineAsync(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the existing or new routine.

GetOrCreateRoutineAsync(string, string, string, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetOrCreateRoutineAsync(string projectId, string datasetId, string routineId, Routine resource, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified routine, creating it if it doesn't exist. This method just creates a RoutineReference and delegates to GetOrCreateRoutineAsync(RoutineReference, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

resource Routine

The routine resource representation to use for the creation. Must not be null. If this routine's RoutineReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetRoutineOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateRoutineOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the existing or new routine.

GetOrCreateTable(TableReference, Table, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(TableReference tableReference, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table, creating it if it doesn't exist.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

GetOrCreateTable(TableReference, TableSchema, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table, creating it if it doesn't exist.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

Example

See GetOrCreateTable for an example using an alternative overload.

GetOrCreateTable(string, string, Table, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(string datasetId, string tableId, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table within this client's project, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTable(TableReference, Table, GetTableOptions, CreateTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

Example

See GetOrCreateTable for an example using an alternative overload.

GetOrCreateTable(string, string, TableSchema, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table within this client's project, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTable(TableReference, TableSchema, GetTableOptions, CreateTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableSchema schema = new TableSchemaBuilder
{
    { "from_player", BigQueryDbType.String },
    { "to_player", BigQueryDbType.String },
    { "message", BigQueryDbType.String }
}.Build();
// If the table isn't found, it will be created.
BigQueryTable table = client.GetOrCreateTable(datasetId, tableId, schema);
// Now populate the table with data...

GetOrCreateTable(string, string, string, Table, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(string projectId, string datasetId, string tableId, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTable(TableReference, Table, GetTableOptions, CreateTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

GetOrCreateTable(string, string, string, TableSchema, GetTableOptions, CreateTableOptions)

public virtual BigQueryTable GetOrCreateTable(string projectId, string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

Attempts to fetch the specified table, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTable(TableReference, TableSchema, GetTableOptions, CreateTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The existing or new table.

Example

See GetOrCreateTable for an example using an alternative overload.

GetOrCreateTableAsync(TableReference, Table, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(TableReference tableReference, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table, creating it if it doesn't exist.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example

See GetOrCreateTableAsync for an example using an alternative overload.

GetOrCreateTableAsync(TableReference, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table, creating it if it doesn't exist.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example

See GetOrCreateTableAsync for an example using an alternative overload.

GetOrCreateTableAsync(string, string, Table, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(string datasetId, string tableId, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table within this client's project, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTableAsync(TableReference, Table, GetTableOptions, CreateTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example

See GetOrCreateTableAsync for an example using an alternative overload.

GetOrCreateTableAsync(string, string, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table within this client's project, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTableAsync(TableReference, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
TableSchema schema = new TableSchemaBuilder
{
    { "from_player", BigQueryDbType.String },
    { "to_player", BigQueryDbType.String },
    { "message", BigQueryDbType.String }
}.Build();
// If the table isn't found, it will be created.
BigQueryTable table = await client.GetOrCreateTableAsync(datasetId, tableId, schema);
// Now populate the table with data...

GetOrCreateTableAsync(string, string, string, Table, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(string projectId, string datasetId, string tableId, Table resource, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTableAsync(TableReference, Table, GetTableOptions, CreateTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

resource Table

The table resource representation to use for the creation. Must not be null. If this table's TableReference is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example

See GetOrCreateTableAsync for an example using an alternative overload.

GetOrCreateTableAsync(string, string, string, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetOrCreateTableAsync(string projectId, string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default)

Asynchronously attempts to fetch the specified table, creating it if it doesn't exist. This method just creates a TableReference and delegates to GetOrCreateTableAsync(TableReference, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

The schema for the new table. Must not be null.

getOptions GetTableOptions

The options for the "get" operation. May be null, in which case defaults will be supplied.

createOptions CreateTableOptions

The options for the "create" operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the existing or new table.

Example

See GetOrCreateTableAsync for an example using an alternative overload.

GetProjectReference(string)

public ProjectReference GetProjectReference(string projectId)

Creates a ProjectReference from the given project ID.

Parameter
Name Description
projectId string

The project ID. Must not be null.

Returns
Type Description
ProjectReference

A ProjectReference representing the requested project.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
ProjectReference reference = client.GetProjectReference("other-project");
Console.WriteLine(reference.ProjectId);

GetQueryResults(JobReference, GetQueryResultsOptions)

public virtual BigQueryResults GetQueryResults(JobReference jobReference, GetQueryResultsOptions options = null)

Retrieves the results of the specified job, which must be a query job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryResults

The results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, historyTableId);
TableReference destination = client.GetTableReference(datasetId, queryTableId);
// If the destination table is not specified, the results will be stored in
// a temporary table.
BigQueryJob job = client.CreateQueryJob(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    null, // No parameters
    new QueryOptions { DestinationTable = destination });

// Wait for the job to complete.
job.PollUntilCompleted();

// Then we can fetch the results, either via the job or by accessing
// the destination table.
BigQueryResults result = client.GetQueryResults(job.Reference);
foreach (BigQueryRow row in result)
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
}

GetQueryResults(string, GetQueryResultsOptions)

public virtual BigQueryResults GetQueryResults(string jobId, GetQueryResultsOptions options = null)

Retrieves the results of the specified job within this client's project, which must be a query job. This method just creates a JobReference and delegates to GetQueryResults(JobReference, GetQueryResultsOptions).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryResults

The results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example

See GetQueryResults for an example using an alternative overload.

GetQueryResults(string, string, GetQueryResultsOptions)

public virtual BigQueryResults GetQueryResults(string projectId, string jobId, GetQueryResultsOptions options = null)

Retrieves the results of the specified job, which must be a query job. This method just creates a JobReference and delegates to GetQueryResults(JobReference, GetQueryResultsOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryResults

The results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example

See GetQueryResults for an example using an alternative overload.

GetQueryResultsAsync(JobReference, GetQueryResultsOptions, CancellationToken)

public virtual Task<BigQueryResults> GetQueryResultsAsync(JobReference jobReference, GetQueryResultsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the results of the specified job, which must be a query job.

Parameters
Name Description
jobReference JobReference

A fully-qualified identifier for the job. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryResults

A task representing the asynchronous operation. When complete, the result is the results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
BigQueryTable table = await client.GetTableAsync(datasetId, historyTableId);
TableReference destination = client.GetTableReference(datasetId, queryTableId);
// If the destination table is not specified, the results will be stored in
// a temporary table.
BigQueryJob job = await client.CreateQueryJobAsync(
    $@"SELECT player, MAX(score) AS score
       FROM {table}
       GROUP BY player
       ORDER BY score DESC",
    null, // No parameters
    new QueryOptions { DestinationTable = destination });

// Wait for the job to complete.
await job.PollUntilCompletedAsync();

// Then we can fetch the results, either via the job or by accessing
// the destination table.
BigQueryResults result = await client.GetQueryResultsAsync(job.Reference);
await result.GetRowsAsync().ForEachAsync(row =>
{
    Console.WriteLine($"{row["player"]}: {row["score"]}");
});

GetQueryResultsAsync(string, GetQueryResultsOptions, CancellationToken)

public virtual Task<BigQueryResults> GetQueryResultsAsync(string jobId, GetQueryResultsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the results of the specified job within this client's project, which must be a query job. This method just creates a JobReference and delegates to GetQueryResultsAsync(JobReference, GetQueryResultsOptions, CancellationToken).

Parameters
Name Description
jobId string

The job ID. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryResults

A task representing the asynchronous operation. When complete, the result is the results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example

See GetQueryResults for an example using an alternative overload.

GetQueryResultsAsync(string, string, GetQueryResultsOptions, CancellationToken)

public virtual Task<BigQueryResults> GetQueryResultsAsync(string projectId, string jobId, GetQueryResultsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the results of the specified job, which must be a query job. This method just creates a JobReference and delegates to GetQueryResultsAsync(JobReference, GetQueryResultsOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

jobId string

The job ID. Must not be null.

options GetQueryResultsOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryResults

A task representing the asynchronous operation. When complete, the result is the results of the query.

Remarks

This operation will only complete when the specified query has completed.

Example

See GetQueryResults for an example using an alternative overload.

GetRoutine(RoutineReference, GetRoutineOptions)

public virtual BigQueryRoutine GetRoutine(RoutineReference routineReference, GetRoutineOptions options = null)

Retrieves the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The requested routine.

GetRoutine(string, string, GetRoutineOptions)

public virtual BigQueryRoutine GetRoutine(string datasetId, string routineId, GetRoutineOptions options = null)

Retrieves the specified routine within this client's project. This method just creates a RoutineReference and delegates to GetRoutine(RoutineReference, GetRoutineOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The requested routine.

GetRoutine(string, string, string, GetRoutineOptions)

public virtual BigQueryRoutine GetRoutine(string projectId, string datasetId, string routineId, GetRoutineOptions options = null)

Retrieves the specified routine. This method just creates a RoutineReference and delegates to GetRoutine(RoutineReference, GetRoutineOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryRoutine

The requested routine.

GetRoutineAsync(RoutineReference, GetRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetRoutineAsync(RoutineReference routineReference, GetRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified routine.

Parameters
Name Description
routineReference RoutineReference

A fully-qualified identifier for the routine. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the requested routine.

GetRoutineAsync(string, string, GetRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetRoutineAsync(string datasetId, string routineId, GetRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified routine within this client's project. This method just creates a RoutineReference and delegates to GetRoutineAsync(RoutineReference, GetRoutineOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the requested routine.

GetRoutineAsync(string, string, string, GetRoutineOptions, CancellationToken)

public virtual Task<BigQueryRoutine> GetRoutineAsync(string projectId, string datasetId, string routineId, GetRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified routine. This method just creates a RoutineReference and delegates to GetRoutineAsync(RoutineReference, GetRoutineOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

options GetRoutineOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryRoutine

A task representing the asynchronous operation. When complete, the result is the requested routine.

GetRoutineReference(string, string)

public RoutineReference GetRoutineReference(string datasetId, string routineId)

Creates a RoutineReference from the given dataset ID and routine ID, using this client's project ID.

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

Returns
Type Description
RoutineReference

A RoutineReference representing the requested routine.

GetRoutineReference(string, string, string)

public RoutineReference GetRoutineReference(string projectId, string datasetId, string routineId)

Creates a RoutineReference from the given project ID, dataset ID and routine ID.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

routineId string

The routine ID. Must not be null.

Returns
Type Description
RoutineReference

A RoutineReference representing the requested routine.

GetTable(TableReference, GetTableOptions)

public virtual BigQueryTable GetTable(TableReference tableReference, GetTableOptions options = null)

Retrieves the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The requested table.

Example

See GetTable for an example using an alternative overload.

GetTable(string, string, GetTableOptions)

public virtual BigQueryTable GetTable(string datasetId, string tableId, GetTableOptions options = null)

Retrieves the specified table within this client's project. This method just creates a TableReference and delegates to GetTable(TableReference, GetTableOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The requested table.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, tableId);
Console.WriteLine(table.FullyQualifiedId);

GetTable(string, string, string, GetTableOptions)

public virtual BigQueryTable GetTable(string projectId, string datasetId, string tableId, GetTableOptions options = null)

Retrieves the specified table. This method just creates a TableReference and delegates to GetTable(TableReference, GetTableOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryTable

The requested table.

Example

See GetTable for an example using an alternative overload.

GetTableAsync(TableReference, GetTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetTableAsync(TableReference tableReference, GetTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the requested table.

Example

See GetTable for a synchronous example.

GetTableAsync(string, string, GetTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetTableAsync(string datasetId, string tableId, GetTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified table within this client's project. This method just creates a TableReference and delegates to GetTableAsync(TableReference, GetTableOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the requested table.

Example

See GetTable for a synchronous example.

GetTableAsync(string, string, string, GetTableOptions, CancellationToken)

public virtual Task<BigQueryTable> GetTableAsync(string projectId, string datasetId, string tableId, GetTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves the specified table. This method just creates a TableReference and delegates to GetTableAsync(TableReference, GetTableOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskBigQueryTable

A task representing the asynchronous operation. When complete, the result is the requested table.

Example

See GetTable for a synchronous example.

GetTableIamPolicy(TableReference, GetTableIamPolicyOptions)

public virtual Policy GetTableIamPolicy(TableReference tableReference, GetTableIamPolicyOptions options = null)

Gets the IAM policy applied to the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
Policy

The table's IAM policy.

GetTableIamPolicy(string, string, GetTableIamPolicyOptions)

public virtual Policy GetTableIamPolicy(string datasetId, string tableId, GetTableIamPolicyOptions options = null)

Gets the IAM policy applied to the specified table within this client's project. This method just creates a TableReference and delegates to GetTableIamPolicy(TableReference, GetTableIamPolicyOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
Policy

The table's IAM policy.

GetTableIamPolicy(string, string, string, GetTableIamPolicyOptions)

public virtual Policy GetTableIamPolicy(string projectId, string datasetId, string tableId, GetTableIamPolicyOptions options = null)

Gets the IAM policy applied to the specified table. This method just creates a TableReference and delegates to GetTableIamPolicy(TableReference, GetTableIamPolicyOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

Returns
Type Description
Policy

The table's IAM policy.

GetTableIamPolicyAsync(TableReference, GetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> GetTableIamPolicyAsync(TableReference tableReference, GetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously gets the IAM policy applied to the specified table.

Parameters
Name Description
tableReference TableReference

A fully-qualified identifier for the table. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskPolicy

A task representing the asynchronous operation. When complete, the result is the table's IAM policy.

GetTableIamPolicyAsync(string, string, GetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> GetTableIamPolicyAsync(string datasetId, string tableId, GetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously gets the IAM policy applied to the specified table within this client's project. This method just creates a TableReference and delegates to GetTableIamPolicyAsync(TableReference, GetTableIamPolicyOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskPolicy

A task representing the asynchronous operation. When complete, the result is the table's IAM policy.

GetTableIamPolicyAsync(string, string, string, GetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> GetTableIamPolicyAsync(string projectId, string datasetId, string tableId, GetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously gets the IAM policy applied to the specified table. This method just creates a TableReference and delegates to GetTableIamPolicyAsync(TableReference, GetTableIamPolicyOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

options GetTableIamPolicyOptions

The options for the operation. May be null, in which case defaults will be supplied.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
TaskPolicy

A task representing the asynchronous operation. When complete, the result is the table's IAM policy.

GetTableReference(string, string)

public TableReference GetTableReference(string datasetId, string tableId)

Creates a TableReference from the given dataset ID and table ID, using this client's project ID.

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

Returns
Type Description
TableReference

A TableReference representing the requested table.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableReference reference = client.GetTableReference("dataset", "table");
// ProjectId is defaulted from the client in this overload
Console.WriteLine(reference.ProjectId);

GetTableReference(string, string, string)

public TableReference GetTableReference(string projectId, string datasetId, string tableId)

Creates a TableReference from the given project ID, dataset ID and table ID.

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

Returns
Type Description
TableReference

A TableReference representing the requested table.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
TableReference reference = client.GetTableReference("other-project", "dataset", "table");
// ProjectId is as specified in the call, not the client's project
Console.WriteLine(reference.ProjectId);

InsertRow(Table