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(TableReference, BigQueryInsertRow, InsertOptions)

public virtual BigQueryInsertResults InsertRow(TableReference tableReference, BigQueryInsertRow row, InsertOptions options = null)

Inserts a single row of data into a table. This method just creates an array with the single element and delegates to InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).

Parameters
Name Description
tableReference TableReference

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

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example

See InsertRow for an example using an alternative overload.

InsertRow(string, string, BigQueryInsertRow, InsertOptions)

public virtual BigQueryInsertResults InsertRow(string datasetId, string tableId, BigQueryInsertRow row, InsertOptions options = null)

Inserts a single row of data into a table in this client's project specified by dataset ID and table ID. This method just creates a TableReference and delegates to InsertRow(TableReference, BigQueryInsertRow, InsertOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// The insert ID is optional; it is autogenerated if not specified.
BigQueryInsertRow row = new BigQueryInsertRow("row-single")
{
    { "player", "Jane" },
    { "level", 3 },
    { "score", 3600 },
    { "game_started", DateTime.UtcNow }
};
client.InsertRow(datasetId, tableId, row);

InsertRow(string, string, string, BigQueryInsertRow, InsertOptions)

public virtual BigQueryInsertResults InsertRow(string projectId, string datasetId, string tableId, BigQueryInsertRow row, InsertOptions options = null)

Inserts a single row of data into a table specified by project ID, dataset ID and table ID. This method just creates a TableReference and delegates to InsertRow(TableReference, BigQueryInsertRow, InsertOptions).

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.

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example

See InsertRow for an example using an alternative overload.

InsertRowAsync(TableReference, BigQueryInsertRow, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowAsync(TableReference tableReference, BigQueryInsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts a single row of data into a table. This method just creates an array with the single element and delegates to InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Parameters
Name Description
tableReference TableReference

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

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRow for a synchronous example.

InsertRowAsync(string, string, BigQueryInsertRow, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowAsync(string datasetId, string tableId, BigQueryInsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts a single row of data into a table in this client's project specified by dataset ID and table ID. This method just creates a TableReference and delegates to InsertRowAsync(TableReference, BigQueryInsertRow, InsertOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRow for a synchronous example.

InsertRowAsync(string, string, string, BigQueryInsertRow, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowAsync(string projectId, string datasetId, string tableId, BigQueryInsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts a single row of data into a table specified by project ID, dataset ID and table ID. This method just creates a TableReference and delegates to InsertRowAsync(TableReference, BigQueryInsertRow, InsertOptions, 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.

row BigQueryInsertRow

The data to insert. Must not be null.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRow for a synchronous example.

InsertRows(TableReference, params BigQueryInsertRow[])

public virtual BigQueryInsertResults InsertRows(TableReference tableReference, params BigQueryInsertRow[] rows)

Inserts all the specified rows into a table. This method just delegates to InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).

Parameters
Name Description
tableReference TableReference

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

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Remarks

Options are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).

Example

See InsertRows for an example using an alternative overload.

InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions)

public virtual BigQueryInsertResults InsertRows(TableReference tableReference, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null)

Inserts all the given rows of data into the specified table.

Parameters
Name Description
tableReference TableReference

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

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example

See InsertRows for an example using an alternative overload.

InsertRows(string, string, params BigQueryInsertRow[])

public virtual BigQueryInsertResults InsertRows(string datasetId, string tableId, params BigQueryInsertRow[] rows)

Inserts all the specified rows into a table in this client's project. This method just creates a TableReference and delegates to InsertRows(TableReference, params BigQueryInsertRow[]).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Remarks

Options are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRows(string, string, IEnumerable<BigQueryInsertRow>, InsertOptions).

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// The insert ID is optional; it is autogenerated if not specified.
BigQueryInsertRow row1 = new BigQueryInsertRow("row1")
{
    { "player", "Jane" },
    { "level", 3 },
    { "score", 3600 },
    { "game_started", DateTime.UtcNow }
};
BigQueryInsertRow row2 = new BigQueryInsertRow("row2")
{
    { "player", "Jeff" },
    { "level", 2 },
    { "score", 2000 },
    { "game_started", DateTime.UtcNow }
};
client.InsertRows(datasetId, tableId, row1, row2);

InsertRows(string, string, IEnumerable<BigQueryInsertRow>, InsertOptions)

public virtual BigQueryInsertResults InsertRows(string datasetId, string tableId, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null)

Inserts all the given rows of data into the specified table within this client's project. This method just creates a TableReference and delegates to InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example

See InsertRows for an example using an alternative overload.

InsertRows(string, string, string, params BigQueryInsertRow[])

public virtual BigQueryInsertResults InsertRows(string projectId, string datasetId, string tableId, params BigQueryInsertRow[] rows)

Inserts all the specified rows into a table. This method just creates a TableReference and delegates to InsertRows(TableReference, params BigQueryInsertRow[]).

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.

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Remarks

Options are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRows(string, string, string, IEnumerable<BigQueryInsertRow>, InsertOptions).

Example

See InsertRows for an example using an alternative overload.

InsertRows(string, string, string, IEnumerable<BigQueryInsertRow>, InsertOptions)

public virtual BigQueryInsertResults InsertRows(string projectId, string datasetId, string tableId, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null)

Inserts all the given rows of data into the specified table. This method just creates a TableReference and delegates to InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).

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.

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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

Returns
Type Description
BigQueryInsertResults

An insert result object which contains information on insert errors if any.

Example

See InsertRows for an example using an alternative overload.

InsertRowsAsync(TableReference, params BigQueryInsertRow[])

public virtual Task<BigQueryInsertResults> InsertRowsAsync(TableReference tableReference, params BigQueryInsertRow[] rows)

Asynchronously inserts all the specified rows into a table. This method just delegates to InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Parameters
Name Description
tableReference TableReference

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

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Remarks

Options and cancellation tokens are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Example

See InsertRowsAsync for an example using an alternative overload.

InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowsAsync(TableReference tableReference, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts all the given rows of data into the specified table.

Parameters
Name Description
tableReference TableReference

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

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRowsAsync for an example using an alternative overload.

InsertRowsAsync(string, string, params BigQueryInsertRow[])

public virtual Task<BigQueryInsertResults> InsertRowsAsync(string datasetId, string tableId, params BigQueryInsertRow[] rows)

Asynchronously inserts all the specified rows into a table in this client's project. This method just creates a TableReference and delegates to InsertRowsAsync(TableReference, params BigQueryInsertRow[]).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Remarks

Options and cancellation tokens are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRowsAsync(string, string, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
// The insert ID is optional; it is autogenerated if not specified.
BigQueryInsertRow row1 = new BigQueryInsertRow("row1-async")
{
    { "player", "Jane" },
    { "level", 3 },
    { "score", 3600 },
    { "game_started", DateTime.UtcNow }
};
BigQueryInsertRow row2 = new BigQueryInsertRow("row2-async")
{
    { "player", "Jeff" },
    { "level", 2 },
    { "score", 2000 },
    { "game_started", DateTime.UtcNow }
};
await client.InsertRowsAsync(datasetId, tableId, row1, row2);

InsertRowsAsync(string, string, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowsAsync(string datasetId, string tableId, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts all the given rows of data into the specified table within this client's project. This method just creates a TableReference and delegates to InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRowsAsync for an example using an alternative overload.

InsertRowsAsync(string, string, string, params BigQueryInsertRow[])

public virtual Task<BigQueryInsertResults> InsertRowsAsync(string projectId, string datasetId, string tableId, params BigQueryInsertRow[] rows)

Inserts all the specified rows into a table. This method just creates a TableReference and delegates to InsertRowsAsync(TableReference, params BigQueryInsertRow[]).

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.

rows BigQueryInsertRow

The rows to insert. Must not be null, or contain null elements.

Returns
Type Description
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Remarks

Options and cancellation tokens are not supported on this call due to restrictions with methods containing a parameter array and optional parameters. To specify options, create a collection or array explicitly, and call InsertRowsAsync(string, string, string, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).

Example

See InsertRowsAsync for an example using an alternative overload.

InsertRowsAsync(string, string, string, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken)

public virtual Task<BigQueryInsertResults> InsertRowsAsync(string projectId, string datasetId, string tableId, IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default)

Asynchronously inserts all the given rows of data into the specified table. This method just creates a TableReference and delegates to InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, 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.

rows IEnumerableBigQueryInsertRow

The data to insert. Must not be null, or contain null entries.

options InsertOptions

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
TaskBigQueryInsertResults

A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any.

Example

See InsertRowsAsync for an example using an alternative overload.

ListDatasets(ProjectReference, ListDatasetsOptions)

public virtual PagedEnumerable<DatasetList, BigQueryDataset> ListDatasets(ProjectReference projectReference, ListDatasetsOptions options = null)

Lists the datasets within the specified project.

Parameters
Name Description
projectReference ProjectReference

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

options ListDatasetsOptions

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

Returns
Type Description
PagedEnumerableDatasetListBigQueryDataset

A sequence of datasets within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListDatasets for an example using an alternative overload.

ListDatasets(ListDatasetsOptions)

public virtual PagedEnumerable<DatasetList, BigQueryDataset> ListDatasets(ListDatasetsOptions options = null)

Lists the datasets within this client's project. This method just creates a ProjectReference and delegates to ListDatasets(ProjectReference, ListDatasetsOptions).

Parameter
Name Description
options ListDatasetsOptions

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

Returns
Type Description
PagedEnumerableDatasetListBigQueryDataset

A sequence of datasets within this project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
List<BigQueryDataset> datasets = client.ListDatasets().Take(20).ToList();
foreach (BigQueryDataset dataset in datasets)
{
    Console.WriteLine(dataset.FullyQualifiedId);
}

ListDatasets(string, ListDatasetsOptions)

public virtual PagedEnumerable<DatasetList, BigQueryDataset> ListDatasets(string projectId, ListDatasetsOptions options = null)

Lists the datasets within the specified project. This method just creates a ProjectReference and delegates to ListDatasets(ProjectReference, ListDatasetsOptions).

Parameters
Name Description
projectId string

The project to list the datasets from. Must not be null.

options ListDatasetsOptions

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

Returns
Type Description
PagedEnumerableDatasetListBigQueryDataset

A sequence of datasets within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListDatasets for an example using an alternative overload.

ListDatasetsAsync(ProjectReference, ListDatasetsOptions)

public virtual PagedAsyncEnumerable<DatasetList, BigQueryDataset> ListDatasetsAsync(ProjectReference projectReference, ListDatasetsOptions options = null)

Asynchronously lists the datasets within the specified project.

Parameters
Name Description
projectReference ProjectReference

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

options ListDatasetsOptions

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

Returns
Type Description
PagedAsyncEnumerableDatasetListBigQueryDataset

An asynchronous sequence of datasets within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListDatasetsAsync for an example using an alternative overload.

ListDatasetsAsync(ListDatasetsOptions)

public virtual PagedAsyncEnumerable<DatasetList, BigQueryDataset> ListDatasetsAsync(ListDatasetsOptions options = null)

Asynchronously lists the datasets within this client's project. This method just creates a ProjectReference and delegates to ListDatasetsAsync(ProjectReference, ListDatasetsOptions).

Parameter
Name Description
options ListDatasetsOptions

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

Returns
Type Description
PagedAsyncEnumerableDatasetListBigQueryDataset

An asynchronous sequence of datasets within this project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
List<BigQueryDataset> datasets = await client.ListDatasetsAsync().Take(20).ToListAsync();
foreach (BigQueryDataset dataset in datasets)
{
    Console.WriteLine(dataset.FullyQualifiedId);
}

ListDatasetsAsync(string, ListDatasetsOptions)

public virtual PagedAsyncEnumerable<DatasetList, BigQueryDataset> ListDatasetsAsync(string projectId, ListDatasetsOptions options = null)

Asynchronously lists the datasets within the specified project. This method just creates a ProjectReference and delegates to ListDatasetsAsync(ProjectReference, ListDatasetsOptions).

Parameters
Name Description
projectId string

The project to list the datasets from. Must not be null.

options ListDatasetsOptions

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

Returns
Type Description
PagedAsyncEnumerableDatasetListBigQueryDataset

An asynchronous sequence of datasets within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListDatasetsAsync for an example using an alternative overload.

ListJobs(ProjectReference, ListJobsOptions)

public virtual PagedEnumerable<JobList, BigQueryJob> ListJobs(ProjectReference projectReference, ListJobsOptions options = null)

Lists the jobs within the specified project.

Parameters
Name Description
projectReference ProjectReference

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

options ListJobsOptions

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

Returns
Type Description
PagedEnumerableJobListBigQueryJob

A sequence of the jobs within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListJobs for an example using an alternative overload.

ListJobs(ListJobsOptions)

public virtual PagedEnumerable<JobList, BigQueryJob> ListJobs(ListJobsOptions options = null)

Lists the jobs within this client's project. This method just creates a ProjectReference and delegates to ListJobs(ProjectReference, ListJobsOptions).

Parameter
Name Description
options ListJobsOptions

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

Returns
Type Description
PagedEnumerableJobListBigQueryJob

A sequence of the jobs within this project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
List<BigQueryJob> jobs = client.ListJobs().Take(20).ToList();
foreach (BigQueryJob job in jobs)
{
    Console.WriteLine(job.Reference.JobId);
}

ListJobs(string, ListJobsOptions)

public virtual PagedEnumerable<JobList, BigQueryJob> ListJobs(string projectId, ListJobsOptions options = null)

Lists the jobs within the specified project. This method just creates a ProjectReference and delegates to ListJobs(ProjectReference, ListJobsOptions).

Parameters
Name Description
projectId string

The project to list the jobs from. Must not be null.

options ListJobsOptions

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

Returns
Type Description
PagedEnumerableJobListBigQueryJob

A sequence of the jobs within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListJobs for an example using an alternative overload.

ListJobsAsync(ProjectReference, ListJobsOptions)

public virtual PagedAsyncEnumerable<JobList, BigQueryJob> ListJobsAsync(ProjectReference projectReference, ListJobsOptions options = null)

Asynchronously lists the jobs within the specified project.

Parameters
Name Description
projectReference ProjectReference

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

options ListJobsOptions

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

Returns
Type Description
PagedAsyncEnumerableJobListBigQueryJob

An asynchronous sequence of the jobs within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListJobs for an example using an alternative overload.

ListJobsAsync(ListJobsOptions)

public virtual PagedAsyncEnumerable<JobList, BigQueryJob> ListJobsAsync(ListJobsOptions options = null)

Asynchronously lists the jobs within this client's project. This method just creates a ProjectReference and delegates to ListJobsAsync(ProjectReference, ListJobsOptions).

Parameter
Name Description
options ListJobsOptions

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

Returns
Type Description
PagedAsyncEnumerableJobListBigQueryJob

An asynchronous sequence of the jobs within this project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
List<BigQueryJob> jobs = await client.ListJobsAsync().Take(20).ToListAsync();
foreach (BigQueryJob job in jobs)
{
    Console.WriteLine(job.Reference.JobId);
}

ListJobsAsync(string, ListJobsOptions)

public virtual PagedAsyncEnumerable<JobList, BigQueryJob> ListJobsAsync(string projectId, ListJobsOptions options = null)

Asynchronously lists the jobs within the specified project. This method just creates a ProjectReference and delegates to ListJobsAsync(ProjectReference, ListJobsOptions).

Parameters
Name Description
projectId string

The project to list the jobs from. Must not be null.

options ListJobsOptions

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

Returns
Type Description
PagedAsyncEnumerableJobListBigQueryJob

An asynchronous sequence of the jobs within the specified project.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListJobs for an example using an alternative overload.

ListModels(DatasetReference, ListModelsOptions)

public virtual PagedEnumerable<ListModelsResponse, BigQueryModel> ListModels(DatasetReference datasetReference, ListModelsOptions options = null)

Lists the models in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListModelsOptions

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

Returns
Type Description
PagedEnumerableListModelsResponseBigQueryModel

A sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListModels(string, ListModelsOptions)

public virtual PagedEnumerable<ListModelsResponse, BigQueryModel> ListModels(string datasetId, ListModelsOptions options = null)

Lists the models in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListModels(DatasetReference, ListModelsOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list models from. Must not be null.

options ListModelsOptions

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

Returns
Type Description
PagedEnumerableListModelsResponseBigQueryModel

A sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListModels(string, string, ListModelsOptions)

public virtual PagedEnumerable<ListModelsResponse, BigQueryModel> ListModels(string projectId, string datasetId, ListModelsOptions options = null)

Lists the models in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListModels(DatasetReference, ListModelsOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list models from. Must not be null.

options ListModelsOptions

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

Returns
Type Description
PagedEnumerableListModelsResponseBigQueryModel

A sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListModelsAsync(DatasetReference, ListModelsOptions)

public virtual PagedAsyncEnumerable<ListModelsResponse, BigQueryModel> ListModelsAsync(DatasetReference datasetReference, ListModelsOptions options = null)

Lists the models in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListModelsOptions

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

Returns
Type Description
PagedAsyncEnumerableListModelsResponseBigQueryModel

A sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListModelsAsync(string, ListModelsOptions)

public virtual PagedAsyncEnumerable<ListModelsResponse, BigQueryModel> ListModelsAsync(string datasetId, ListModelsOptions options = null)

Lists the models in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListModelsAsync(DatasetReference, ListModelsOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list models from. Must not be null.

options ListModelsOptions

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

Returns
Type Description
PagedAsyncEnumerableListModelsResponseBigQueryModel

An asynchronous sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListModelsAsync(string, string, ListModelsOptions)

public virtual PagedAsyncEnumerable<ListModelsResponse, BigQueryModel> ListModelsAsync(string projectId, string datasetId, ListModelsOptions options = null)

Lists the models in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListModelsAsync(DatasetReference, ListModelsOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list models from. Must not be null.

options ListModelsOptions

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

Returns
Type Description
PagedAsyncEnumerableListModelsResponseBigQueryModel

An asynchronous sequence of models within the dataset.

Remarks

The returned models will not have all the properties in the resource populated. For complete information, make a GetModel call for each model you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListProjects(ListProjectsOptions)

public virtual PagedEnumerable<ProjectList, CloudProject> ListProjects(ListProjectsOptions options = null)

Lists the cloud projects available using the current credentials.

Parameter
Name Description
options ListProjectsOptions

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

Returns
Type Description
PagedEnumerableProjectListCloudProject

A sequence of projects the user has access to.

Remarks

The project associated with this client is irrelevant for this operation.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create("irrelevant");
PagedEnumerable<ProjectList, CloudProject> projects = client.ListProjects();
foreach (CloudProject project in projects)
{
    Console.WriteLine($"{project.ProjectId}: {project.FriendlyName}");
}

ListProjectsAsync(ListProjectsOptions)

public virtual PagedAsyncEnumerable<ProjectList, CloudProject> ListProjectsAsync(ListProjectsOptions options = null)

Asynchronously lists the cloud projects available using the current credentials.

Parameter
Name Description
options ListProjectsOptions

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

Returns
Type Description
PagedAsyncEnumerableProjectListCloudProject

An asynchronous sequence of projects the user has access to.

Remarks

The project associated with this client is irrelevant for this operation.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create("irrelevant");
PagedAsyncEnumerable<ProjectList, CloudProject> projects = client.ListProjectsAsync();
await projects.ForEachAsync(project =>
{
    Console.WriteLine($"{project.ProjectId}: {project.FriendlyName}");
});

ListRoutines(DatasetReference, ListRoutinesOptions)

public virtual PagedEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutines(DatasetReference datasetReference, ListRoutinesOptions options = null)

Lists the routines in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListRoutinesOptions

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

Returns
Type Description
PagedEnumerableListRoutinesResponseBigQueryRoutine

A sequence of tables within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRoutines(string, ListRoutinesOptions)

public virtual PagedEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutines(string datasetId, ListRoutinesOptions options = null)

Lists the routines in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListRoutines(DatasetReference, ListRoutinesOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list routines from. Must not be null.

options ListRoutinesOptions

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

Returns
Type Description
PagedEnumerableListRoutinesResponseBigQueryRoutine

A sequence of routines within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRoutines(string, string, ListRoutinesOptions)

public virtual PagedEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutines(string projectId, string datasetId, ListRoutinesOptions options = null)

Lists the routines in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListRoutines(DatasetReference, ListRoutinesOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list routines from. Must not be null.

options ListRoutinesOptions

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

Returns
Type Description
PagedEnumerableListRoutinesResponseBigQueryRoutine

A sequence of routines within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRoutinesAsync(DatasetReference, ListRoutinesOptions)

public virtual PagedAsyncEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutinesAsync(DatasetReference datasetReference, ListRoutinesOptions options = null)

Lists the routines in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListRoutinesOptions

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

Returns
Type Description
PagedAsyncEnumerableListRoutinesResponseBigQueryRoutine

A sequence of routines within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRoutinesAsync(string, ListRoutinesOptions)

public virtual PagedAsyncEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutinesAsync(string datasetId, ListRoutinesOptions options = null)

Lists the routines in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListRoutinesAsync(DatasetReference, ListRoutinesOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list routines from. Must not be null.

options ListRoutinesOptions

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

Returns
Type Description
PagedAsyncEnumerableListRoutinesResponseBigQueryRoutine

An asynchronous sequence of routines within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRoutinesAsync(string, string, ListRoutinesOptions)

public virtual PagedAsyncEnumerable<ListRoutinesResponse, BigQueryRoutine> ListRoutinesAsync(string projectId, string datasetId, ListRoutinesOptions options = null)

Lists the routines in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListRoutinesAsync(DatasetReference, ListRoutinesOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list routines from. Must not be null.

options ListRoutinesOptions

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

Returns
Type Description
PagedAsyncEnumerableListRoutinesResponseBigQueryRoutine

An asynchronous sequence of routines within the dataset.

Remarks

The returned routines will contain populated properties as specified by ReadMask or the default ones. ReadMask for more information.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

ListRows(TableReference, TableSchema, ListRowsOptions)

public virtual PagedEnumerable<TableDataList, BigQueryRow> ListRows(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table, similar to a SELECT * FROM ... query.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema to use when interpreting results. If this is a partial schema, then partial rows will be fetched. See SelectedFields for how to obtain a table's partial schema. This may be null or empty (i.e. Fields null or empty), in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedEnumerableTableDataListBigQueryRow

The results of listing the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListRows for an example using an alternative overload.

ListRows(string, string, TableSchema, ListRowsOptions)

public virtual PagedEnumerable<TableDataList, BigQueryRow> ListRows(string datasetId, string tableId, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table within this client's project specified by dataset ID and table ID, similar to a SELECT * FROM ... query. This method just creates a TableReference and delegates to ListRows(TableReference, TableSchema, ListRowsOptions).

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 to use when interpreting results. If this is a partial schema, then partial rows will be fetched. See SelectedFields for how to obtain a table's partial schema. This may be null or empty (i.e. Fields null or empty), in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedEnumerableTableDataListBigQueryRow

The results of listing the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
PagedEnumerable<TableDataList, BigQueryRow> result = client.ListRows(datasetId, tableId);
foreach (BigQueryRow row in result)
{
    DateTime timestamp = (DateTime) row["game_started"];
    long level = (long) row["level"];
    long score = (long) row["score"];
    string player = (string) row["player"];
    Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})");
}

ListRows(string, string, string, TableSchema, ListRowsOptions)

public virtual PagedEnumerable<TableDataList, BigQueryRow> ListRows(string projectId, string datasetId, string tableId, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table specified by project ID, dataset ID and table ID, similar to a SELECT * FROM ... query. This method just creates a TableReference and delegates to ListRows(TableReference, TableSchema, ListRowsOptions).

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 to use when interpreting results. This may be null, in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedEnumerableTableDataListBigQueryRow

The results of listing the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListRows for an example using an alternative overload.

ListRowsAsync(TableReference, TableSchema, ListRowsOptions)

public virtual PagedAsyncEnumerable<TableDataList, BigQueryRow> ListRowsAsync(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table, similar to a SELECT * FROM ... query.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema to use when interpreting results. This may be null, in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedAsyncEnumerableTableDataListBigQueryRow

An asynchronous sequence of the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListRowsAsync for an example using an alternative overload.

ListRowsAsync(string, string, TableSchema, ListRowsOptions)

public virtual PagedAsyncEnumerable<TableDataList, BigQueryRow> ListRowsAsync(string datasetId, string tableId, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table within this client's project specified by dataset ID and table ID, similar to a SELECT * FROM ... query. This method just creates a TableReference and delegates to ListRowsAsync(TableReference, TableSchema, ListRowsOptions).

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 to use when interpreting results. This may be null, in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedAsyncEnumerableTableDataListBigQueryRow

An asynchronous sequence of the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
PagedAsyncEnumerable<TableDataList, BigQueryRow> result = client.ListRowsAsync(datasetId, tableId);
await result.ForEachAsync(row =>
{
    DateTime timestamp = (DateTime) row["game_started"];
    long level = (long) row["level"];
    long score = (long) row["score"];
    string player = (string) row["player"];
    Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})");
});

ListRowsAsync(string, string, string, TableSchema, ListRowsOptions)

public virtual PagedAsyncEnumerable<TableDataList, BigQueryRow> ListRowsAsync(string projectId, string datasetId, string tableId, TableSchema schema = null, ListRowsOptions options = null)

Lists the rows within a table specified by project ID, dataset ID and table ID, similar to a SELECT * FROM ... query. This method just creates a TableReference and delegates to ListRowsAsync(TableReference, TableSchema, ListRowsOptions).

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 to use when interpreting results. This may be null, in which case it will be fetched from the table first.

options ListRowsOptions

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

Returns
Type Description
PagedAsyncEnumerableTableDataListBigQueryRow

An asynchronous sequence of the rows within the table.

Remarks

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListRowsAsync for an example using an alternative overload.

ListTables(DatasetReference, ListTablesOptions)

public virtual PagedEnumerable<TableList, BigQueryTable> ListTables(DatasetReference datasetReference, ListTablesOptions options = null)

Lists the tables in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListTablesOptions

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

Returns
Type Description
PagedEnumerableTableListBigQueryTable

A sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListTables for an example using an alternative overload.

ListTables(string, ListTablesOptions)

public virtual PagedEnumerable<TableList, BigQueryTable> ListTables(string datasetId, ListTablesOptions options = null)

Lists the tables in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListTables(DatasetReference, ListTablesOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list tables from. Must not be null.

options ListTablesOptions

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

Returns
Type Description
PagedEnumerableTableListBigQueryTable

A sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
List<BigQueryTable> tables = client.ListTables(datasetId).Take(20).ToList();
foreach (BigQueryTable table in tables)
{
    Console.WriteLine(table.FullyQualifiedId);
}

ListTables(string, string, ListTablesOptions)

public virtual PagedEnumerable<TableList, BigQueryTable> ListTables(string projectId, string datasetId, ListTablesOptions options = null)

Lists the tables in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListTables(DatasetReference, ListTablesOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list tables from. Must not be null.

options ListTablesOptions

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

Returns
Type Description
PagedEnumerableTableListBigQueryTable

A sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListTables for an example using an alternative overload.

ListTablesAsync(DatasetReference, ListTablesOptions)

public virtual PagedAsyncEnumerable<TableList, BigQueryTable> ListTablesAsync(DatasetReference datasetReference, ListTablesOptions options = null)

Lists the tables in a dataset.

Parameters
Name Description
datasetReference DatasetReference

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

options ListTablesOptions

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

Returns
Type Description
PagedAsyncEnumerableTableListBigQueryTable

A sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListTablesAsync for an example using an alternative overload.

ListTablesAsync(string, ListTablesOptions)

public virtual PagedAsyncEnumerable<TableList, BigQueryTable> ListTablesAsync(string datasetId, ListTablesOptions options = null)

Lists the tables in a dataset specified by dataset ID, where the dataset is in this client's project. This method just creates a DatasetReference and delegates to ListTablesAsync(DatasetReference, ListTablesOptions).

Parameters
Name Description
datasetId string

The ID of the dataset to list tables from. Must not be null.

options ListTablesOptions

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

Returns
Type Description
PagedAsyncEnumerableTableListBigQueryTable

An asynchronous sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
List<BigQueryTable> tables = await client.ListTablesAsync(datasetId).Take(20).ToListAsync();
foreach (BigQueryTable table in tables)
{
    Console.WriteLine(table.FullyQualifiedId);
}

ListTablesAsync(string, string, ListTablesOptions)

public virtual PagedAsyncEnumerable<TableList, BigQueryTable> ListTablesAsync(string projectId, string datasetId, ListTablesOptions options = null)

Lists the tables in a dataset specified by project ID and dataset ID. This method just creates a DatasetReference and delegates to ListTablesAsync(DatasetReference, ListTablesOptions).

Parameters
Name Description
projectId string

The ID of the project containing the dataset. Must not be null.

datasetId string

The ID of the dataset to list tables from. Must not be null.

options ListTablesOptions

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

Returns
Type Description
PagedAsyncEnumerableTableListBigQueryTable

An asynchronous sequence of tables within the dataset.

Remarks

The returned tables will not have all the properties in the resource populated. For complete information, make a GetTable call for each table you need the details of.

No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.

Example

See ListTablesAsync for an example using an alternative overload.

ModifyDatasetLabels(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions)

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

Sets or removes one or more labels on the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

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

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example

See ModifyDatasetLabels for an example using an alternative overload.

ModifyDatasetLabels(string, IDictionary<string, string>, ModifyLabelsOptions)

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

Sets or removes one or more labels on the specified dataset within this client's project. This method just creates a DatasetReference and delegates to ModifyDatasetLabels(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

IDictionary<string, string> modifications = new Dictionary<string, string>
{
    { "set_me", "x" },    // Label "set_me" will be set to value "x"
    { "remove_me", null } // Label "remove_me" will be removed
};

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

ModifyDatasetLabels(string, string, IDictionary<string, string>, ModifyLabelsOptions)

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

Sets or removes one or more labels on the specified dataset. This method just creates a DatasetReference and delegates to ModifyDatasetLabels(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example

See ModifyDatasetLabels for an example using an alternative overload.

ModifyDatasetLabelsAsync(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions, CancellationToken)

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

Asynchronously sets or removes one or more labels on the specified dataset.

Parameters
Name Description
datasetReference DatasetReference

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

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example

See ModifyDatasetLabels for a synchronous example.

ModifyDatasetLabelsAsync(string, IDictionary<string, string>, ModifyLabelsOptions, CancellationToken)

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

Asynchronously sets or removes one or more labels on the specified dataset within this client's project. This method just creates a DatasetReference and delegates to ModifyDatasetLabelsAsync(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example

See ModifyDatasetLabels for a synchronous example.

ModifyDatasetLabelsAsync(string, string, IDictionary<string, string>, ModifyLabelsOptions, CancellationToken)

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

Asynchronously sets or removes one or more labels on the specified dataset. This method just creates a DatasetReference and delegates to ModifyDatasetLabelsAsync(DatasetReference, IDictionary<string, string>, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labels IDictionarystringstring

The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal).

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 same keys as labels, and values indicating the corresponding label value before this operation completed. Labels which weren't present on the dataset before the modification have corresponding null values in the returned dictionary.

Remarks

Each entry in labels is treated as a label to set or remove. If the value is null, it will be removed from the dataset; otherwise, it will be set/added. Labels which do not have an entry in the dictionary will be ignored.

Example

See ModifyDatasetLabels for a synchronous example.

PatchDataset(DatasetReference, Dataset, PatchDatasetOptions)

public virtual BigQueryDataset PatchDataset(DatasetReference datasetReference, Dataset resource, PatchDatasetOptions options = null)

Patches the specified dataset with fields in the given resource.

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 patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchDataset for an example using an alternative overload.

PatchDataset(string, Dataset, PatchDatasetOptions)

public virtual BigQueryDataset PatchDataset(string datasetId, Dataset resource, PatchDatasetOptions options = null)

Patches the specified dataset within this client's project with fields in the given resource. This method just creates a DatasetReference and delegates to PatchDataset(DatasetReference, Dataset, PatchDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

// There's no ETag in this Dataset, so the patch will be applied unconditionally.
// If we specified an ETag, the patch would only be applied if it matched.
client.PatchDataset(datasetId, new Dataset { FriendlyName = "Patched dataset" } );

// Fetch just to make sure it's really changed...
BigQueryDataset fetched = client.GetDataset(datasetId);
Console.WriteLine($"Fetched dataset friendly name: {fetched.Resource.FriendlyName}");

PatchDataset(string, string, Dataset, PatchDatasetOptions)

public virtual BigQueryDataset PatchDataset(string projectId, string datasetId, Dataset resource, PatchDatasetOptions options = null)

Patches the specified dataset with fields in the given resource. This method just creates a DatasetReference and delegates to PatchDataset(DatasetReference, Dataset, PatchDatasetOptions).

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 patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchDataset for an example using an alternative overload.

PatchDatasetAsync(DatasetReference, Dataset, PatchDatasetOptions, CancellationToken)

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

Asynchronously patches the specified dataset with fields in the given resource.

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 patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchDataset for a synchronous example.

PatchDatasetAsync(string, Dataset, PatchDatasetOptions, CancellationToken)

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

Asynchronously patches the specified dataset within this client's project with fields in the given resource. This method just creates a DatasetReference and delegates to PatchDatasetAsync(DatasetReference, Dataset, PatchDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchDataset for a synchronous example.

PatchDatasetAsync(string, string, Dataset, PatchDatasetOptions, CancellationToken)

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

Asynchronously patches the specified dataset with fields in the given resource. This method just creates a DatasetReference and delegates to PatchDatasetAsync(DatasetReference, Dataset, PatchDatasetOptions, 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 patch. Only fields present in the resource will be updated.

options PatchDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchDataset for a synchronous example.

PatchModel(ModelReference, Model, PatchModelOptions)

public virtual BigQueryModel PatchModel(ModelReference modelReference, Model resource, PatchModelOptions options = null)

Patches the specified model with fields in the given resource.

Parameters
Name Description
modelReference ModelReference

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

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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

Returns
Type Description
BigQueryModel

The updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchModel(string, string, Model, PatchModelOptions)

public virtual BigQueryModel PatchModel(string datasetId, string modelId, Model resource, PatchModelOptions options = null)

Patches the specified model within this client's project with fields in the given resource. This method just creates a ModelReference and delegates to PatchModel(ModelReference, Model, PatchModelOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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

Returns
Type Description
BigQueryModel

The updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchModel(string, string, string, Model, PatchModelOptions)

public virtual BigQueryModel PatchModel(string projectId, string datasetId, string modelId, Model resource, PatchModelOptions options = null)

Patches the specified model with fields in the given resource. This method just creates a ModelReference and delegates to PatchModel(ModelReference, Model, PatchModelOptions).

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.

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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

Returns
Type Description
BigQueryModel

The updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchModelAsync(ModelReference, Model, PatchModelOptions, CancellationToken)

public virtual Task<BigQueryModel> PatchModelAsync(ModelReference modelReference, Model resource, PatchModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously patches the specified model with fields in the given resource.

Parameters
Name Description
modelReference ModelReference

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

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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 updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchModelAsync(string, string, Model, PatchModelOptions, CancellationToken)

public virtual Task<BigQueryModel> PatchModelAsync(string datasetId, string modelId, Model resource, PatchModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously patches the specified model within this client's project with fields in the given resource. This method just creates a ModelReference and delegates to PatchModelAsync(ModelReference, Model, PatchModelOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

modelId string

The model ID. Must not be null.

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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 updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchModelAsync(string, string, string, Model, PatchModelOptions, CancellationToken)

public virtual Task<BigQueryModel> PatchModelAsync(string projectId, string datasetId, string modelId, Model resource, PatchModelOptions options = null, CancellationToken cancellationToken = default)

Asynchronously patches the specified model with fields in the given resource. This method just creates a ModelReference and delegates to PatchModelAsync(ModelReference, Model, PatchModelOptions, 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.

resource Model

The model resource representation to use for the patch. Only fields present in the resource will be updated.

options PatchModelOptions

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 updated model.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

PatchTable(TableReference, Table, PatchTableOptions)

public virtual BigQueryTable PatchTable(TableReference tableReference, Table resource, PatchTableOptions options = null)

Patches the specified table with fields in the given resource.

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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchTable for an example using an alternative overload.

PatchTable(string, string, Table, PatchTableOptions)

public virtual BigQueryTable PatchTable(string datasetId, string tableId, Table resource, PatchTableOptions options = null)

Patches the specified table within this client's project with fields in the given resource. This method just creates a TableReference and delegates to PatchTable(TableReference, Table, PatchTableOptions).

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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

// There's no ETag in this Table, so the patch will be applied unconditionally.
// If we specified an ETag, the patch would only be applied if it matched.
client.PatchTable(datasetId, tableId, new Table { FriendlyName = "Patched table" });

// Fetch just to make sure it's really changed...
BigQueryTable fetched = client.GetTable(datasetId, tableId);
Console.WriteLine($"Fetched table friendly name: {fetched.Resource.FriendlyName}");

PatchTable(string, string, string, Table, PatchTableOptions)

public virtual BigQueryTable PatchTable(string projectId, string datasetId, string tableId, Table resource, PatchTableOptions options = null)

Patches the specified table with fields in the given resource. This method just creates a TableReference and delegates to PatchTable(TableReference, Table, PatchTableOptions).

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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchTable for an example using an alternative overload.

PatchTableAsync(TableReference, Table, PatchTableOptions, CancellationToken)

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

Asynchronously patches the specified table with fields in the given resource.

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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchTable for a synchronous example.

PatchTableAsync(string, string, Table, PatchTableOptions, CancellationToken)

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

Asynchronously patches the specified table within this client's project with fields in the given resource. This method just creates a TableReference and delegates to PatchTableAsync(TableReference, Table, PatchTableOptions, 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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchTable for a synchronous example.

PatchTableAsync(string, string, string, Table, PatchTableOptions, CancellationToken)

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

Asynchronously patches the specified table with fields in the given resource. This method just creates a TableReference and delegates to PatchTableAsync(TableReference, Table, PatchTableOptions, 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 patch. Only fields present in the resource will be updated.

options PatchTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See PatchTable for a synchronous example.

PollJobUntilCompleted(JobReference, GetJobOptions, PollSettings)

public virtual BigQueryJob PollJobUntilCompleted(JobReference jobReference, GetJobOptions options = null, PollSettings pollSettings = null)

Polls the specified job for completion.

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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The completed job.

Example

See PollJobUntilCompleted for an example using an alternative overload.

PollJobUntilCompleted(string, GetJobOptions, PollSettings)

public virtual BigQueryJob PollJobUntilCompleted(string jobId, GetJobOptions options = null, PollSettings pollSettings = null)

Polls the specified job within this client's project for completion. This method just creates a JobReference and delegates to PollJobUntilCompleted(JobReference, GetJobOptions, PollSettings).

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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The completed 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);
string jobId = job.Reference.JobId;
// Imagine code here to store the ID somewhere, e.g. a database.
// We later come back and want to wait for the job to complete.

BigQueryJob completedJob = client.PollJobUntilCompleted(jobId);

PollJobUntilCompleted(string, string, GetJobOptions, PollSettings)

public virtual BigQueryJob PollJobUntilCompleted(string projectId, string jobId, GetJobOptions options = null, PollSettings pollSettings = null)

Polls the specified job for completion. This method just creates a JobReference and delegates to PollJobUntilCompleted(JobReference, GetJobOptions, PollSettings).

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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. May be null, in which case defaults will be supplied.

Returns
Type Description
BigQueryJob

The completed job.

Example

See PollJobUntilCompleted for an example using an alternative overload.

PollJobUntilCompletedAsync(JobReference, GetJobOptions, PollSettings, CancellationToken)

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

Asynchronously polls the specified job for completion.

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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. 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 completed job.

Example

See PollJobUntilCompleted for a synchronous example.

PollJobUntilCompletedAsync(string, GetJobOptions, PollSettings, CancellationToken)

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

Asynchronously polls the specified job within this client's project for completion. This method just creates a JobReference and delegates to PollJobUntilCompletedAsync(JobReference, GetJobOptions, PollSettings, 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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. 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 completed job.

Example

See PollJobUntilCompleted for a synchronous example.

PollJobUntilCompletedAsync(string, string, GetJobOptions, PollSettings, CancellationToken)

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

Asynchronously polls the specified job for completion. This method just creates a JobReference and delegates to PollJobUntilCompletedAsync(JobReference, GetJobOptions, PollSettings, 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.

pollSettings PollSettings

The settings to control how often and long the job is fetched before timing out if it is still incomplete. 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 completed job.

Example

See PollJobUntilCompleted for a synchronous example.

RemoveDatasetLabel(DatasetReference, string, ModifyLabelsOptions)

public virtual string RemoveDatasetLabel(DatasetReference datasetReference, string labelName, ModifyLabelsOptions options = null)

Removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist.

Parameters
Name Description
datasetReference DatasetReference

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

labelName string

The name of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Example

See RemoveDatasetLabel for an example using an alternative overload.

RemoveDatasetLabel(string, string, ModifyLabelsOptions)

public virtual string RemoveDatasetLabel(string datasetId, string labelName, ModifyLabelsOptions options = null)

Removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist. This method just creates a DatasetReference and delegates to RemoveDatasetLabel(DatasetReference, string, ModifyLabelsOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

string previousValue = client.RemoveDatasetLabel(datasetId, "labelName");
Console.WriteLine($"Previous label value: {previousValue}");

RemoveDatasetLabel(string, string, string, ModifyLabelsOptions)

public virtual string RemoveDatasetLabel(string projectId, string datasetId, string labelName, ModifyLabelsOptions options = null)

Removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist. This method just creates a DatasetReference and delegates to RemoveDatasetLabel(DatasetReference, string, ModifyLabelsOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Example

See RemoveDatasetLabel for an example using an alternative overload.

RemoveDatasetLabelAsync(DatasetReference, string, ModifyLabelsOptions, CancellationToken)

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

Asynchronously removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist.

Parameters
Name Description
datasetReference DatasetReference

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

labelName string

The name of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Example

See RemoveDatasetLabel for a synchronous example.

RemoveDatasetLabelAsync(string, string, ModifyLabelsOptions, CancellationToken)

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

Asynchronously removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist. This method just creates a DatasetReference and delegates to RemoveDatasetLabelAsync(DatasetReference, string, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Example

See RemoveDatasetLabel for a synchronous example.

RemoveDatasetLabelAsync(string, string, string, ModifyLabelsOptions, CancellationToken)

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

Asynchronously removes a label from a dataset, if it previously existed. It is not an error to attempt to remove a label that doesn't already exist. This method just creates a DatasetReference and delegates to RemoveDatasetLabelAsync(DatasetReference, string, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Example

See RemoveDatasetLabel for a synchronous example.

SetDatasetLabel(DatasetReference, string, string, ModifyLabelsOptions)

public virtual string SetDatasetLabel(DatasetReference datasetReference, string labelName, string labelValue, ModifyLabelsOptions options = null)

Sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists.

Parameters
Name Description
datasetReference DatasetReference

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

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example

See SetDatasetLabel for an example using an alternative overload.

SetDatasetLabel(string, string, string, ModifyLabelsOptions)

public virtual string SetDatasetLabel(string datasetId, string labelName, string labelValue, ModifyLabelsOptions options = null)

Sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists. This method just creates a DatasetReference and delegates to SetDatasetLabel(DatasetReference, string, string, ModifyLabelsOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example
BigQueryClient client = BigQueryClient.Create(projectId);

string previousValue = client.SetDatasetLabel(datasetId, "label_name", "new_label_value");
Console.WriteLine($"Previous label value: {previousValue}");

SetDatasetLabel(string, string, string, string, ModifyLabelsOptions)

public virtual string SetDatasetLabel(string projectId, string datasetId, string labelName, string labelValue, ModifyLabelsOptions options = null)

Sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists. This method just creates a DatasetReference and delegates to SetDatasetLabel(DatasetReference, string, string, ModifyLabelsOptions).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. Must not be null.

options ModifyLabelsOptions

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

Returns
Type Description
string

The previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example

See SetDatasetLabel for an example using an alternative overload.

SetDatasetLabelAsync(DatasetReference, string, string, ModifyLabelsOptions, CancellationToken)

public virtual Task<string> SetDatasetLabelAsync(DatasetReference datasetReference, string labelName, string labelValue, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists.

Parameters
Name Description
datasetReference DatasetReference

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

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example

See SetDatasetLabel for a synchronous example.

SetDatasetLabelAsync(string, string, string, ModifyLabelsOptions, CancellationToken)

public virtual Task<string> SetDatasetLabelAsync(string datasetId, string labelName, string labelValue, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists. This method just creates a DatasetReference and delegates to SetDatasetLabelAsync(DatasetReference, string, string, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example

See SetDatasetLabel for a synchronous example.

SetDatasetLabelAsync(string, string, string, string, ModifyLabelsOptions, CancellationToken)

public virtual Task<string> SetDatasetLabelAsync(string projectId, string datasetId, string labelName, string labelValue, ModifyLabelsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously sets the value for a single label on a dataset. The label will be added if it does not exist, or updated if it already exists. This method just creates a DatasetReference and delegates to SetDatasetLabelAsync(DatasetReference, string, string, ModifyLabelsOptions, CancellationToken).

Parameters
Name Description
projectId string

The project ID. Must not be null.

datasetId string

The dataset ID. Must not be null.

labelName string

The name of the label. Must not be null.

labelValue string

The new value of the label. 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
Taskstring

A task representing the asynchronous operation. When complete, the result is the previous value of the label, or null if the label was not previously set.

Remarks

The dataset is first fetched to retrieve the current values, then a patch call is made.

Example

See SetDatasetLabel for a synchronous example.

SetTableIamPolicy(TableReference, Policy, SetTableIamPolicyOptions)

public virtual Policy SetTableIamPolicy(TableReference tableReference, Policy policy, SetTableIamPolicyOptions options = null)

Applies the given IAM policy to the specified table.

Parameters
Name Description
tableReference TableReference

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

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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

Returns
Type Description
Policy

The resulting IAM policy after aplying the given policy.

SetTableIamPolicy(string, string, Policy, SetTableIamPolicyOptions)

public virtual Policy SetTableIamPolicy(string datasetId, string tableId, Policy policy, SetTableIamPolicyOptions options = null)

Applies the given IAM policy to the specified table within this client's project. This method just creates a TableReference and delegates to SetTableIamPolicy(TableReference, Policy, SetTableIamPolicyOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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

Returns
Type Description
Policy

The resulting IAM policy after aplying the given policy.

SetTableIamPolicy(string, string, string, Policy, SetTableIamPolicyOptions)

public virtual Policy SetTableIamPolicy(string projectId, string datasetId, string tableId, Policy policy, SetTableIamPolicyOptions options = null)

Applies the given IAM policy to the specified table. This method just creates a TableReference and delegates to SetTableIamPolicy(TableReference, Policy, SetTableIamPolicyOptions).

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.

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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

Returns
Type Description
Policy

The resulting IAM policy after aplying the given policy.

SetTableIamPolicyAsync(TableReference, Policy, SetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> SetTableIamPolicyAsync(TableReference tableReference, Policy policy, SetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously applies the given IAM policy to the specified table.

Parameters
Name Description
tableReference TableReference

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

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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 resulting IAM policy after aplying the given policy.

SetTableIamPolicyAsync(string, string, Policy, SetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> SetTableIamPolicyAsync(string datasetId, string tableId, Policy policy, SetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously applies the given IAM policy to the specified table within this client's project. This method just creates a TableReference and delegates to SetTableIamPolicyAsync(TableReference, Policy, SetTableIamPolicyOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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 resulting IAM policy after aplying the given policy.

SetTableIamPolicyAsync(string, string, string, Policy, SetTableIamPolicyOptions, CancellationToken)

public virtual Task<Policy> SetTableIamPolicyAsync(string projectId, string datasetId, string tableId, Policy policy, SetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default)

Asynchronously applies the given IAM policy to the specified table. This method just creates a TableReference and delegates to SetTableIamPolicyAsync(TableReference, Policy, SetTableIamPolicyOptions, 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.

policy Policy

The policy to set on the table. An update mask may be specified through options.

options SetTableIamPolicyOptions

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 resulting IAM policy after aplying the given policy.

TestTableIamPermissions(TableReference, IList<string>, TestTableIamPermissionsOptions)

public virtual TestIamPermissionsResponse TestTableIamPermissions(TableReference tableReference, IList<string> permissions, TestTableIamPermissionsOptions options = null)

Returns the subset of permissions that the caller has on the specified table.

Parameters
Name Description
tableReference TableReference

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

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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

Returns
Type Description
TestIamPermissionsResponse

The subset of permissions that the caller has on {target}.

TestTableIamPermissions(string, string, IList<string>, TestTableIamPermissionsOptions)

public virtual TestIamPermissionsResponse TestTableIamPermissions(string datasetId, string tableId, IList<string> permissions, TestTableIamPermissionsOptions options = null)

Returns the subset of permissions that the caller has on the specified table within this client's project. This method just creates a TableReference and delegates to TestTableIamPermissions(TableReference, IList<string>, TestTableIamPermissionsOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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

Returns
Type Description
TestIamPermissionsResponse

The subset of permissions that the caller has on {target}.

TestTableIamPermissions(string, string, string, IList<string>, TestTableIamPermissionsOptions)

public virtual TestIamPermissionsResponse TestTableIamPermissions(string projectId, string datasetId, string tableId, IList<string> permissions, TestTableIamPermissionsOptions options = null)

Returns the subset of permissions that the caller has on the specified table. This method just creates a TableReference and delegates to TestTableIamPermissions(TableReference, IList<string>, TestTableIamPermissionsOptions).

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.

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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

Returns
Type Description
TestIamPermissionsResponse

The subset of permissions that the caller has on {target}.

TestTableIamPermissionsAsync(TableReference, IList<string>, TestTableIamPermissionsOptions, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestTableIamPermissionsAsync(TableReference tableReference, IList<string> permissions, TestTableIamPermissionsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously returns the subset of permissions that the caller has on the specified table.

Parameters
Name Description
tableReference TableReference

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

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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
TaskTestIamPermissionsResponse

A task representing the asynchronous operation. When complete, the result is the subset of permissions that the caller has on {target}.

TestTableIamPermissionsAsync(string, string, IList<string>, TestTableIamPermissionsOptions, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestTableIamPermissionsAsync(string datasetId, string tableId, IList<string> permissions, TestTableIamPermissionsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously returns the subset of permissions that the caller has on the specified table within this client's project. This method just creates a TableReference and delegates to TestTableIamPermissionsAsync(TableReference, IList<string>, TestTableIamPermissionsOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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
TaskTestIamPermissionsResponse

A task representing the asynchronous operation. When complete, the result is the subset of permissions that the caller has on {target}.

TestTableIamPermissionsAsync(string, string, string, IList<string>, TestTableIamPermissionsOptions, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestTableIamPermissionsAsync(string projectId, string datasetId, string tableId, IList<string> permissions, TestTableIamPermissionsOptions options = null, CancellationToken cancellationToken = default)

Asynchronously returns the subset of permissions that the caller has on the specified table. This method just creates a TableReference and delegates to TestTableIamPermissionsAsync(TableReference, IList<string>, TestTableIamPermissionsOptions, 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.

permissions IListstring

The permissions to test on the table.

options TestTableIamPermissionsOptions

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
TaskTestIamPermissionsResponse

A task representing the asynchronous operation. When complete, the result is the subset of permissions that the caller has on {target}.

UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions)

public virtual BigQueryDataset UpdateDataset(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null)

Updates the specified dataset to match the specified resource.

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 update. All updatable fields will be updated.

options UpdateDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateDataset for an example using an alternative overload.

UpdateDataset(string, Dataset, UpdateDatasetOptions)

public virtual BigQueryDataset UpdateDataset(string datasetId, Dataset resource, UpdateDatasetOptions options = null)

Updates the specified dataset within this client's project to match the specified resource. This method just creates a DatasetReference and delegates to UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the update. All updatable fields will be updated.

options UpdateDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryDataset dataset = client.GetDataset(datasetId);
Dataset resource = dataset.Resource;
resource.FriendlyName = "Updated dataset";

// Alternatively, just call dataset.Update(). In either case,
// the etag in the resource will automatically be used for optimistic concurrency.
client.UpdateDataset(datasetId, resource);

// Fetch just to make sure it's really changed...
BigQueryDataset fetched = client.GetDataset(datasetId);
Console.WriteLine($"Fetched dataset friendly name: {fetched.Resource.FriendlyName}");

UpdateDataset(string, string, Dataset, UpdateDatasetOptions)

public virtual BigQueryDataset UpdateDataset(string projectId, string datasetId, Dataset resource, UpdateDatasetOptions options = null)

Updates the specified dataset to match the specified resource. This method just creates a DatasetReference and delegates to UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions).

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 update. All updatable fields will be updated.

options UpdateDatasetOptions

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

Returns
Type Description
BigQueryDataset

The updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateDataset for an example using an alternative overload.

UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, CancellationToken)

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

Asynchronously updates the specified dataset to match the specified resource.

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 update. All updatable fields will be updated.

options UpdateDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateDataset for a synchronous example.

UpdateDatasetAsync(string, Dataset, UpdateDatasetOptions, CancellationToken)

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

Asynchronously updates the specified dataset within this client's project to match the specified resource. This method just creates a DatasetReference and delegates to UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

resource Dataset

The dataset resource representation to use for the update. All updatable fields will be updated.

options UpdateDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateDataset for a synchronous example.

UpdateDatasetAsync(string, string, Dataset, UpdateDatasetOptions, CancellationToken)

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

Asynchronously updates the specified dataset to match the specified resource. This method just creates a DatasetReference and delegates to UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, 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 update. All updatable fields will be updated.

options UpdateDatasetOptions

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 updated dataset.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateDataset for a synchronous example.

UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions)

public virtual BigQueryRoutine UpdateRoutine(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options = null)

Updates the specified routine to match the specified resource.

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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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

Returns
Type Description
BigQueryRoutine

The updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateRoutine(string, string, Routine, UpdateRoutineOptions)

public virtual BigQueryRoutine UpdateRoutine(string datasetId, string routineId, Routine resource, UpdateRoutineOptions options = null)

Updates the specified routine within this client's project to match the specified resource. This method just creates a RoutineReference and delegates to UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions).

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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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

Returns
Type Description
BigQueryRoutine

The updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateRoutine(string, string, string, Routine, UpdateRoutineOptions)

public virtual BigQueryRoutine UpdateRoutine(string projectId, string datasetId, string routineId, Routine resource, UpdateRoutineOptions options = null)

Updates the specified routine to match the specified resource. This method just creates a RoutineReference and delegates to UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions).

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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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

Returns
Type Description
BigQueryRoutine

The updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, CancellationToken)

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

Asynchronously updates the specified routine to match the specified resource.

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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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 updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateRoutineAsync(string, string, Routine, UpdateRoutineOptions, CancellationToken)

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

Asynchronously updates the specified routine within this client's project to match the specified resource. This method just creates a RoutineReference and delegates to UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, 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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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 updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateRoutineAsync(string, string, string, Routine, UpdateRoutineOptions, CancellationToken)

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

Asynchronously updates the specified routine to match the specified resource. This method just creates a RoutineReference and delegates to UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, 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 update. All updatable fields will be updated. 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 UpdateRoutineOptions

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 updated routine.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

UpdateTable(TableReference, Table, UpdateTableOptions)

public virtual BigQueryTable UpdateTable(TableReference tableReference, Table resource, UpdateTableOptions options = null)

Updates the specified table to match the specified resource.

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 update. All updatable fields will be updated.

options UpdateTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateTable for an example using an alternative overload.

UpdateTable(string, string, Table, UpdateTableOptions)

public virtual BigQueryTable UpdateTable(string datasetId, string tableId, Table resource, UpdateTableOptions options = null)

Updates the specified table within this client's project to match the specified resource. This method just creates a TableReference and delegates to UpdateTable(TableReference, Table, UpdateTableOptions).

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 update. All updatable fields will be updated.

options UpdateTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, tableId);
Table resource = table.Resource;
resource.FriendlyName = "Updated table";

// Alternatively, just call table.Update(). In either case,
// the etag in the resource will automatically be used for optimistic concurrency.
client.UpdateTable(datasetId, tableId, resource);

// Fetch just to make sure it's really changed...
BigQueryTable fetched = client.GetTable(datasetId, tableId);
Console.WriteLine($"Fetched table friendly name: {fetched.Resource.FriendlyName}");

UpdateTable(string, string, string, Table, UpdateTableOptions)

public virtual BigQueryTable UpdateTable(string projectId, string datasetId, string tableId, Table resource, UpdateTableOptions options = null)

Updates the specified table to match the specified resource. This method just creates a TableReference and delegates to UpdateTable(TableReference, Table, UpdateTableOptions).

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 update. All updatable fields will be updated.

options UpdateTableOptions

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

Returns
Type Description
BigQueryTable

The updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateTable for an example using an alternative overload.

UpdateTableAsync(TableReference, Table, UpdateTableOptions, CancellationToken)

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

Asynchronously updates the specified table to match the specified resource.

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 update. All updatable fields will be updated.

options UpdateTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateTable for a synchronous example.

UpdateTableAsync(string, string, Table, UpdateTableOptions, CancellationToken)

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

Asynchronously updates the specified table within this client's project to match the specified resource. This method just creates a TableReference and delegates to UpdateTableAsync(TableReference, Table, UpdateTableOptions, 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 update. All updatable fields will be updated.

options UpdateTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateTable for a synchronous example.

UpdateTableAsync(string, string, string, Table, UpdateTableOptions, CancellationToken)

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

Asynchronously updates the specified table to match the specified resource. This method just creates a TableReference and delegates to UpdateTableAsync(TableReference, Table, UpdateTableOptions, 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 update. All updatable fields will be updated.

options UpdateTableOptions

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 updated table.

Remarks

If the resource contains an ETag, it is used for optimistic concurrency validation.

Example

See UpdateTable for a synchronous example.

UploadAvro(TableReference, TableSchema, Stream, UploadAvroOptions)

public virtual BigQueryJob UploadAvro(TableReference tableReference, TableSchema schema, Stream input, UploadAvroOptions options = null)

Uploads a stream of Avro data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadAvro for an example using an alternative overload.

UploadAvro(string, string, TableSchema, Stream, UploadAvroOptions)

public virtual BigQueryJob UploadAvro(string datasetId, string tableId, TableSchema schema, Stream input, UploadAvroOptions options = null)

Uploads a stream of Avro data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadAvro(TableReference, TableSchema, Stream, UploadAvroOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// This example creates a new table. Any schema provided is ignored, as Avro
// is self-describing. (The parameter only exists for legacy reasons.)
BigQueryJob job = client.UploadAvro(datasetId, tableId, null, stream);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadAvro(string, string, string, TableSchema, Stream, UploadAvroOptions)

public virtual BigQueryJob UploadAvro(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadAvroOptions options = null)

Uploads a stream of Avro data to the specified table. This method just creates a TableReference and delegates to UploadAvro(TableReference, TableSchema, Stream, UploadAvroOptions).

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

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadAvro for an example using an alternative overload.

UploadAvroAsync(TableReference, TableSchema, Stream, UploadAvroOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadAvroAsync(TableReference tableReference, TableSchema schema, Stream input, UploadAvroOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Avro data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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 a data upload job.

Example

See UploadAvro for a synchronous example.

UploadAvroAsync(string, string, TableSchema, Stream, UploadAvroOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadAvroAsync(string datasetId, string tableId, TableSchema schema, Stream input, UploadAvroOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Avro data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadAvroAsync(TableReference, TableSchema, Stream, UploadAvroOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

schema TableSchema

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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 a data upload job.

Example

See UploadAvro for a synchronous example.

UploadAvroAsync(string, string, string, TableSchema, Stream, UploadAvroOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadAvroAsync(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadAvroOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Avro data to the specified table. This method just creates a TableReference and delegates to UploadAvroAsync(TableReference, TableSchema, Stream, UploadAvroOptions, 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

Unused. In earlier versions this specified the schema of the data, but it is now ignored as the schema is always inferred from the data. The parameter is only present for backward compatibility.

input Stream

The stream of input data. Must not be null.

options UploadAvroOptions

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 a data upload job.

Example

See UploadAvro for a synchronous example.

UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions)

public virtual BigQueryJob UploadCsv(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions options = null)

Uploads a stream of CSV data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadCsv for an example using an alternative overload.

UploadCsv(string, string, TableSchema, Stream, UploadCsvOptions)

public virtual BigQueryJob UploadCsv(string datasetId, string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null)

Uploads a stream of CSV data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
string[] csvRows =
{
    "player,score,level,game_started",
    "Tim,5000,3,2014-08-19T12:41:35.220Z",
    "Holly,6000,4,2014-08-03T08:45:35.123Z",
    "Jane,2402,1,2015-01-20T10:13:35.059Z"
};

// Normally we'd be uploading from a file or similar. Any readable stream can be used.
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(string.Join("\n", csvRows)));

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the CSV isn't identical to the schema in the table (for example if the
// columns are in a different order), create a schema to pass into the call, or set
// options.Autodetect to true.
TableSchema schema = null;
BigQueryJob job = client.UploadCsv(datasetId, tableId, schema, stream,
    // Our sample data has a header row, so we need to skip it.
    new UploadCsvOptions { SkipLeadingRows = 1 });
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadCsv(string, string, string, TableSchema, Stream, UploadCsvOptions)

public virtual BigQueryJob UploadCsv(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null)

Uploads a stream of CSV data to the specified table. This method just creates a TableReference and delegates to UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadCsv for an example using an alternative overload.

UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadCsvAsync(TableReference tableReference, TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of CSV data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadCsvAsync for an example using an alternative overload.

UploadCsvAsync(string, string, TableSchema, Stream, UploadCsvOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadCsvAsync(string datasetId, string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of CSV data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
string[] csvRows =
{
    "player,score,level,game_started",
    "Tim,5000,3,2014-08-19T12:41:35.220Z",
    "Holly,6000,4,2014-08-03T08:45:35.123Z",
    "Jane,2402,1,2015-01-20T10:13:35.059Z"
};

// Normally we'd be uploading from a file or similar. Any readable stream can be used.
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(string.Join("\n", csvRows)));

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the CSV isn't identical to the schema in the table (for example if the
// columns are in a different order), create a schema to pass into the call.
TableSchema schema = null;
BigQueryJob job = await client.UploadCsvAsync(datasetId, tableId, schema, stream,
    // Our sample data has a header row, so we need to skip it.
    new UploadCsvOptions { SkipLeadingRows = 1 });
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadCsvAsync(string, string, string, TableSchema, Stream, UploadCsvOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadCsvAsync(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of CSV data to the specified table. This method just creates a TableReference and delegates to UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadCsvOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadCsvAsync for an example using an alternative overload.

UploadJson(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions)

public virtual BigQueryJob UploadJson(TableReference tableReference, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null)

Uploads a sequence of JSON rows to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions)

public virtual BigQueryJob UploadJson(TableReference tableReference, TableSchema schema, Stream input, UploadJsonOptions options = null)

Uploads a stream of JSON data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJson(string, string, TableSchema, IEnumerable<string>, UploadJsonOptions)

public virtual BigQueryJob UploadJson(string datasetId, string tableId, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null)

Uploads a sequence of JSON rows to the specified table within this client's project. This method just creates a TableReference and delegates to UploadJson(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// Note that there's a single line per JSON object. This is not a JSON array.
IEnumerable<string> jsonRows = new string[]
{
    "{ 'player': 'Jean', 'score': 500, 'level': 1, 'game_started': '2012-08-19 12:41:35.220' }",
    "{ 'player': 'Joe', 'score': 705, 'level': 1, 'game_started': '2014-01-01 08:30:35.000' }",
}.Select(row => row.Replace('\'', '"')); // Simple way of representing C# in JSON to avoid escaping " everywhere.

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the JSON isn't identical to the schema in the table,
// create a schema to pass into the call.
TableSchema schema = null;
BigQueryJob job = client.UploadJson(datasetId, tableId, schema, jsonRows);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadJson(string, string, TableSchema, Stream, UploadJsonOptions)

public virtual BigQueryJob UploadJson(string datasetId, string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null)

Uploads a stream of JSON data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// Note that there's a single line per JSON object. This is not a JSON array.
IEnumerable<string> jsonRows = new string[]
{
    "{ 'player': 'John', 'score': 50, 'level': 1, 'game_started': '2014-08-19 12:41:35.220' }",
    "{ 'player': 'Zoe', 'score': 605, 'level': 1, 'game_started': '2016-01-01 08:30:35.000' }",
}.Select(row => row.Replace('\'', '"')); // Simple way of representing C# in JSON to avoid escaping " everywhere.

// Normally we'd be uploading from a file or similar. Any readable stream can be used.
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(string.Join("\n", jsonRows)));

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the JSON isn't identical to the schema in the table,
// create a schema to pass into the call, or set options.Autodetect to true.
TableSchema schema = null;
BigQueryJob job = client.UploadJson(datasetId, tableId, schema, stream);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadJson(string, string, string, TableSchema, IEnumerable<string>, UploadJsonOptions)

public virtual BigQueryJob UploadJson(string projectId, string datasetId, string tableId, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null)

Uploads a sequence of JSON rows to the specified table. This method just creates a TableReference and delegates to UploadJson(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJson(string, string, string, TableSchema, Stream, UploadJsonOptions)

public virtual BigQueryJob UploadJson(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null)

Uploads a stream of JSON data to the specified table. This method just creates a TableReference and delegates to UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions).

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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJsonAsync(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(TableReference tableReference, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a sequence of JSON rows to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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 a data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(TableReference tableReference, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of JSON data to the specified table.

Parameters
Name Description
tableReference TableReference

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

schema TableSchema

The schema of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJsonAsync(string, string, TableSchema, IEnumerable<string>, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(string datasetId, string tableId, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a sequence of JSON rows to the specified table within this client's project. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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 a data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
// Note that there's a single line per JSON object. This is not a JSON array.
IEnumerable<string> jsonRows = new string[]
{
    "{ 'player': 'Jean', 'score': 500, 'level': 1, 'game_started': '2012-08-19 12:41:35.220' }",
    "{ 'player': 'Joe', 'score': 705, 'level': 1, 'game_started': '2014-01-01 08:30:35.000' }",
}.Select(row => row.Replace('\'', '"')); // Simple way of representing C# in JSON to avoid escaping " everywhere.

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the JSON isn't identical to the schema in the table,
// create a schema to pass into the call.
TableSchema schema = null;
BigQueryJob job = await client.UploadJsonAsync(datasetId, tableId, schema, jsonRows);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadJsonAsync(string, string, TableSchema, Stream, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(string datasetId, string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of JSON data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example
BigQueryClient client = await BigQueryClient.CreateAsync(projectId);
// Note that there's a single line per JSON object. This is not a JSON array.
IEnumerable<string> jsonRows = new string[]
{
    "{ 'player': 'John', 'score': 50, 'level': 1, 'game_started': '2014-08-19 12:41:35.220' }",
    "{ 'player': 'Zoe', 'score': 605, 'level': 1, 'game_started': '2016-01-01 08:30:35.000' }",
}.Select(row => row.Replace('\'', '"')); // Simple way of representing C# in JSON to avoid escaping " everywhere.

// Normally we'd be uploading from a file or similar. Any readable stream can be used.
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(string.Join("\n", jsonRows)));

// This example uploads data to an existing table. If the upload will create a new table
// or if the schema in the JSON isn't identical to the schema in the table,
// create a schema to pass into the call.
TableSchema schema = null;
BigQueryJob job = await client.UploadJsonAsync(datasetId, tableId, schema, stream);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadJsonAsync(string, string, string, TableSchema, IEnumerable<string>, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(string projectId, string datasetId, string tableId, TableSchema schema, IEnumerable<string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a sequence of JSON rows to the specified table. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

rows IEnumerablestring

The sequence of JSON strings to upload. Must not be null, and must not contain null elements.

options UploadJsonOptions

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 a data upload job.

Remarks

Each element of rows is converted into a single line of text by replacing carriage returns and line feeds with spaces. This is safe as they cannot exist within well-formed JSON keys or values, and simply means that the original JSON can be formatted however you choose.

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadJsonAsync(string, string, string, TableSchema, Stream, UploadJsonOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadJsonAsync(string projectId, string datasetId, string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of JSON data to the specified table. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, 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 of the data, or null for the schema to be loaded from the destination table or inferred (based on options).

input Stream

The stream of input data. Must not be null.

options UploadJsonOptions

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 a data upload job.

Remarks

The schema can come from three places: it can be specified by schema, it can be retrieved from the destination table if that already exists, or it can be inferred by the server. If schema is null and the Autodetect of options is not set to true, it is expected that the table already exists, and its schema is loaded automatically.

Example

See UploadJson for an example using an alternative overload.

UploadOrc(TableReference, Stream, UploadOrcOptions)

public virtual BigQueryJob UploadOrc(TableReference tableReference, Stream input, UploadOrcOptions options = null)

Uploads a stream of ORC data to the specified table.

Parameters
Name Description
tableReference TableReference

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

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadOrc for an example using an alternative overload.

UploadOrc(string, string, Stream, UploadOrcOptions)

public virtual BigQueryJob UploadOrc(string datasetId, string tableId, Stream input, UploadOrcOptions options = null)

Uploads a stream of ORC data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadOrc(TableReference, Stream, UploadOrcOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// This example creates a new table.
BigQueryJob job = client.UploadOrc(datasetId, tableId, stream);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadOrc(string, string, string, Stream, UploadOrcOptions)

public virtual BigQueryJob UploadOrc(string projectId, string datasetId, string tableId, Stream input, UploadOrcOptions options = null)

Uploads a stream of ORC data to the specified table. This method just creates a TableReference and delegates to UploadOrc(TableReference, Stream, UploadOrcOptions).

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.

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadOrc for an example using an alternative overload.

UploadOrcAsync(TableReference, Stream, UploadOrcOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadOrcAsync(TableReference tableReference, Stream input, UploadOrcOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of ORC data to the specified table.

Parameters
Name Description
tableReference TableReference

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

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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 a data upload job.

Example

See UploadOrc for a synchronous example.

UploadOrcAsync(string, string, Stream, UploadOrcOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadOrcAsync(string datasetId, string tableId, Stream input, UploadOrcOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of ORC data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadOrcAsync(TableReference, Stream, UploadOrcOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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 a data upload job.

Example

See UploadOrc for a synchronous example.

UploadOrcAsync(string, string, string, Stream, UploadOrcOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadOrcAsync(string projectId, string datasetId, string tableId, Stream input, UploadOrcOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of ORC data to the specified table. This method just creates a TableReference and delegates to UploadOrcAsync(TableReference, Stream, UploadOrcOptions, 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.

input Stream

The stream of input data. Must not be null.

options UploadOrcOptions

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 a data upload job.

Example

See UploadOrc for a synchronous example.

UploadParquet(TableReference, Stream, UploadParquetOptions)

public virtual BigQueryJob UploadParquet(TableReference tableReference, Stream input, UploadParquetOptions options = null)

Uploads a stream of Parquet data to the specified table.

Parameters
Name Description
tableReference TableReference

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

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadParquet for an example using an alternative overload.

UploadParquet(string, string, Stream, UploadParquetOptions)

public virtual BigQueryJob UploadParquet(string datasetId, string tableId, Stream input, UploadParquetOptions options = null)

Uploads a stream of Parquet data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadParquet(TableReference, Stream, UploadParquetOptions).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example
BigQueryClient client = BigQueryClient.Create(projectId);
// This example creates a new table.
BigQueryJob job = client.UploadParquet(datasetId, tableId, stream);
// Use the job to find out when the data has finished being inserted into the table,
// report errors etc.

UploadParquet(string, string, string, Stream, UploadParquetOptions)

public virtual BigQueryJob UploadParquet(string projectId, string datasetId, string tableId, Stream input, UploadParquetOptions options = null)

Uploads a stream of Parquet data to the specified table. This method just creates a TableReference and delegates to UploadParquet(TableReference, Stream, UploadParquetOptions).

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.

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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

Returns
Type Description
BigQueryJob

A data upload job.

Example

See UploadParquet for an example using an alternative overload.

UploadParquetAsync(TableReference, Stream, UploadParquetOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadParquetAsync(TableReference tableReference, Stream input, UploadParquetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Parquet data to the specified table.

Parameters
Name Description
tableReference TableReference

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

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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 a data upload job.

Example

See UploadParquet for a synchronous example.

UploadParquetAsync(string, string, Stream, UploadParquetOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadParquetAsync(string datasetId, string tableId, Stream input, UploadParquetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Parquet data to the specified table within this client's project. This method just creates a TableReference and delegates to UploadParquetAsync(TableReference, Stream, UploadParquetOptions, CancellationToken).

Parameters
Name Description
datasetId string

The dataset ID. Must not be null.

tableId string

The table ID. Must not be null.

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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 a data upload job.

Example

See UploadParquet for a synchronous example.

UploadParquetAsync(string, string, string, Stream, UploadParquetOptions, CancellationToken)

public virtual Task<BigQueryJob> UploadParquetAsync(string projectId, string datasetId, string tableId, Stream input, UploadParquetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Parquet data to the specified table. This method just creates a TableReference and delegates to UploadParquetAsync(TableReference, Stream, UploadParquetOptions, 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.

input Stream

The stream of input data. Must not be null.

options UploadParquetOptions

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 a data upload job.

Example

See UploadParquet for a synchronous example.

WithDefaultLocation(string)

public virtual BigQueryClient WithDefaultLocation(string defaultLocation)

Creates a new client which uses the specified location by default for all operations where locations can be specified, such as dataset and job creation.

Parameter
Name Description
defaultLocation string

The location to use by default, for job creation etc.

Returns
Type Description
BigQueryClient

A new client with the specified default location.

Remarks

Implementations should normally ensure that the object returned is of the same type as this client, in case users need implementation-specific features of that client.

Example
BigQueryClient client = BigQueryClient.Create(projectId).WithDefaultLocation(Locations.Tokyo);

// This dataset will be implicitly created in the Tokyo region. All jobs will also
// be implicitly created in the Tokyo region.
BigQueryDataset dataset = client.CreateDataset(datasetId);