Google BigQuery v2 API - Class BigQueryDataset (3.9.0)

public sealed class BigQueryDataset

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

A dataset within BigQuery.

Inheritance

object > BigQueryDataset

Namespace

Google.Cloud.BigQuery.V2

Assembly

Google.Cloud.BigQuery.V2.dll

Remarks

This class wraps the underlying REST API resource and retains a reference to the original client, allowing for simpler dataset-oriented operations.

Constructors

BigQueryDataset(BigQueryClient, Dataset)

public BigQueryDataset(BigQueryClient client, Dataset resource)

Constructs a new dataset.

Parameters
Name Description
client BigQueryClient

The client to use for operations on the dataset. Must not be null.

resource Dataset

The REST-ful resource representing the dataset. Must not be null.

Remarks

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

Properties

FullyQualifiedId

public string FullyQualifiedId { get; }

The fully-qualified identifier for the dataset in a string form of project:dataset.

Property Value
Type Description
string

Reference

public DatasetReference Reference { get; }

The fully-qualified identifier for the dataset as a DatasetReference.

Property Value
Type Description
DatasetReference
Remarks

The properties within the reference can be used to determine the project ID and dataset ID components.

Resource

public Dataset Resource { get; }

The underlying REST-ful resource for the dataset.

Property Value
Type Description
Dataset
Remarks

The data within the resource may be incomplete, depending on how it was obtained.

Methods

CreateRoutine(string, Routine, CreateRoutineOptions)

public BigQueryRoutine CreateRoutine(string routineId, Routine routine, CreateRoutineOptions options = null)

Creates a routine within this dataset. This method just creates a RoutineReference and delegates to CreateRoutine(RoutineReference, Routine, CreateRoutineOptions).

Parameters
Name Description
routineId string

The routine ID. Must not be null.

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

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(string, Routine, CreateRoutineOptions, CancellationToken)

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

Asynchronously creates a routine within this dataset. This method just creates a RoutineReference and delegates to CreateRoutineAsync(RoutineReference, Routine, CreateRoutineOptions, CancellationToken).

Parameters
Name Description
routineId string

The routine ID. Must not be null.

routine Routine

The routine resource representation to use for the creation. Must not be null. If this table's RoutineReference is specified, then it must be the same as 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(string, Table, CreateTableOptions)

public BigQueryTable CreateTable(string tableId, Table table, CreateTableOptions options = null)

Creates a table within this dataset. This method just creates a TableReference and delegates to CreateTable(TableReference, Table, CreateTableOptions).

Parameters
Name Description
tableId string

The table ID. Must not be null.

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

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 BigQueryClient.CreateTable for an example using BigQueryClient.

CreateTable(string, TableSchema, CreateTableOptions)

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

Creates a table within this dataset. This method just creates a TableReference and delegates to CreateTable(TableReference, TableSchema, CreateTableOptions).

Parameters
Name Description
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 BigQueryClient.CreateTable for an example using BigQueryClient.

CreateTableAsync(string, Table, CreateTableOptions, CancellationToken)

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

Asynchronously creates a table within this dataset. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, Table, CreateTableOptions, CancellationToken).

Parameters
Name Description
tableId string

The table ID. Must not be null.

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

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 BigQueryClient.CreateTableAsync for an example using BigQueryClient.

CreateTableAsync(string, TableSchema, CreateTableOptions, CancellationToken)

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

Asynchronously creates a table within this dataset. This method just creates a TableReference and delegates to CreateTableAsync(TableReference, TableSchema, CreateTableOptions, CancellationToken).

Parameters
Name Description
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 BigQueryClient.CreateTableAsync for an example using BigQueryClient.

Delete(DeleteDatasetOptions)

public void Delete(DeleteDatasetOptions options = null)

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

Parameter
Name Description
options DeleteDatasetOptions

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

Example

See BigQueryClient.Delete for an example using BigQueryClient.

DeleteAsync(DeleteDatasetOptions, CancellationToken)

public Task DeleteAsync(DeleteDatasetOptions options = null, CancellationToken cancellationToken = default)

Deletes this dataset. This method just creates a DatasetReference and delegates to DeleteDatasetAsync(DatasetReference, DeleteDatasetOptions, CancellationToken).

Parameters
Name Description
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 BigQueryClient.DeleteDatasetAsync for an example using BigQueryClient.

GetModel(string, GetModelOptions)

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

Retrieves a model within this dataset. This method just creates a ModelReference and delegates to GetModel(ModelReference, GetModelOptions).

Parameters
Name Description
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(string, GetModelOptions, CancellationToken)

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

Asynchronously retrieves a model within this dataset. This method just creates a ModelReference and delegates to GetModel(ModelReference, GetModelOptions).

Parameters
Name Description
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 table.

GetModelReference(string)

public ModelReference GetModelReference(string modelId)

Creates a ModelReference for a model within this dataset.

Parameter
Name Description
modelId string

The model ID. Must not be null.

Returns
Type Description
ModelReference

A ModelReference representing the requested model.

GetOrCreateRoutine(string, Routine, GetRoutineOptions, CreateRoutineOptions)

public BigQueryRoutine GetOrCreateRoutine(string routineId, Routine routine, GetRoutineOptions getOptions = null, CreateRoutineOptions createOptions = null)

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

Parameters
Name Description
routineId string

The routine ID. Must not be null.

routine Routine

The routine resource representation to use for the creation. Must not be null. If this table's RoutineReference is specified, then it must be the same as 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(string, Routine, GetRoutineOptions, CreateRoutineOptions, CancellationToken)

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

Attempts to fetch the specified routine within this dataset, 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
routineId string

The routine ID. Must not be null.

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

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(string, Table, GetTableOptions, CreateTableOptions)

public BigQueryTable GetOrCreateTable(string tableId, Table table, GetTableOptions getOptions = null, CreateTableOptions createOptions = null)

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

Parameters
Name Description
tableId string

The table ID. Must not be null.

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

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 BigQueryClient.GetOrCreateTable for an example using BigQueryClient.

GetOrCreateTable(string, TableSchema, GetTableOptions, CreateTableOptions)

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

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

Parameters
Name Description
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 BigQueryClient.GetOrCreateTable for an example using BigQueryClient.

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

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

Attempts to fetch the specified table within this dataset, 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
tableId string

The table ID. Must not be null.

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

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 BigQueryClient.GetOrCreateTable for an example using BigQueryClient.

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

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

Attempts to fetch the specified table within this dataset, 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
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 BigQueryClient.GetOrCreateTable for an example using BigQueryClient.

GetRoutine(string, GetRoutineOptions)

public BigQueryRoutine GetRoutine(string routineId, GetRoutineOptions options = null)

Retrieves a routine within this dataset. This method just creates a RoutineReference and delegates to GetRoutine(RoutineReference, GetRoutineOptions).

Parameters
Name Description
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(string, GetRoutineOptions, CancellationToken)

public Task<BigQueryRoutine> GetRoutineAsync(string routineId, GetRoutineOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves a routine within this dataset. This method just creates a RoutineReference and delegates to GetRoutineAsync(RoutineReference, GetRoutineOptions, CancellationToken).

Parameters
Name Description
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 table.

GetRoutineReference(string)

public RoutineReference GetRoutineReference(string routineId)

Creates a RoutineReference for a routine within this dataset.

Parameter
Name Description
routineId string

The routine ID. Must not be null.

Returns
Type Description
RoutineReference

A RoutineReference representing the requested routine.

GetTable(string, GetTableOptions)

public BigQueryTable GetTable(string tableId, GetTableOptions options = null)

Retrieves a table within this dataset. This method just creates a TableReference and delegates to GetTable(TableReference, GetTableOptions).

Parameters
Name Description
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 BigQueryClient.GetTable for an example using BigQueryClient.

GetTableAsync(string, GetTableOptions, CancellationToken)

public Task<BigQueryTable> GetTableAsync(string tableId, GetTableOptions options = null, CancellationToken cancellationToken = default)

Asynchronously retrieves a table within this dataset. This method just creates a TableReference and delegates to GetTableAsync(TableReference, GetTableOptions, CancellationToken).

Parameters
Name Description
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 BigQueryClient.GetTable for an example using BigQueryClient.

GetTableReference(string)

public TableReference GetTableReference(string tableId)

Creates a TableReference for a table within this dataset.

Parameter
Name Description
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);
BigQueryDataset dataset = client.GetDataset(datasetId);
TableReference reference = dataset.GetTableReference("table");
Console.WriteLine(reference);

ListModels(ListModelsOptions)

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

Lists the models within this dataset. This method just creates a DatasetReference and delegates to ListModels(DatasetReference, ListModelsOptions).

Parameter
Name Description
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 this dataset.

ListModelsAsync(ListModelsOptions)

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

Asynchronously lists the models within this dataset. This method just creates a DatasetReference and delegates to ListModelsAsync(DatasetReference, ListModelsOptions).

Parameter
Name Description
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 this dataset.

ListRoutines(ListRoutinesOptions)

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

Lists the routines within this dataset. This method just creates a DatasetReference and delegates to ListRoutines(DatasetReference, ListRoutinesOptions).

Parameter
Name Description
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 this dataset.

ListRoutinesAsync(ListRoutinesOptions)

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

Asynchronously lists the routines within this dataset. This method just creates a DatasetReference and delegates to ListRoutinesAsync(DatasetReference, ListRoutinesOptions).

Parameter
Name Description
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 this dataset.

ListTables(ListTablesOptions)

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

Lists the tables within this dataset. This method just creates a DatasetReference and delegates to ListTables(DatasetReference, ListTablesOptions).

Parameter
Name Description
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 this dataset.

Example

See BigQueryClient.ListTables for an example using BigQueryClient.

ListTablesAsync(ListTablesOptions)

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

Asynchronously lists the tables within this dataset. This method just creates a DatasetReference and delegates to ListTablesAsync(DatasetReference, ListTablesOptions).

Parameter
Name Description
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 this dataset.

Example

See BigQueryClient.ListTablesAsync for an example using BigQueryClient.

Patch(Dataset, bool, PatchDatasetOptions)

public BigQueryDataset Patch(Dataset resource, bool matchETag, PatchDatasetOptions options = null)

Patches this dataset with fields in the specified resource.

Parameters
Name Description
resource Dataset

The resource to patch with. Must not be null.

matchETag bool

If true, the etag from Resource is propagated into resource for optimistic concurrency. Otherwise, resource is left unchanged.

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 Example
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryDataset dataset = client.GetDataset(datasetId);

// There's no ETag in this Dataset. The matchETag parameter in the method call
// determines whether the ETag in the original resource is propagated into the
// patch.
Dataset patch = new Dataset
{
    FriendlyName = "Patched dataset"
};
BigQueryDataset updated = dataset.Patch(patch, matchETag: true);

Console.WriteLine($"Patched dataset friendly name: {updated.Resource.FriendlyName}");

PatchAsync(Dataset, bool, PatchDatasetOptions, CancellationToken)

public Task<BigQueryDataset> PatchAsync(Dataset resource, bool matchETag, PatchDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously patches this dataset with fields in the specified resource.

Parameters
Name Description
resource Dataset

The resource to patch with. Must not be null.

matchETag bool

If true, the etag from Resource is propagated into resource for optimistic concurrency. Otherwise, resource is left unchanged.

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 Example

See Patch for a synchronous example.

Update(Dataset, UpdateDatasetOptions)

public BigQueryDataset Update(Dataset resource = null, UpdateDatasetOptions options = null)

Updates this dataset to match the specified resource.

Parameters
Name Description
resource Dataset

The resource to update with. If null, the Resource property is used.

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

This method delegates to UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions). A simple way of updating the dataset is to modify Resource and then call this method with no arguments. This is convenient, but it's important to understand that modifying Resource in this way leaves this object in an unusual state - it represents "the dataset as it was when fetched, but then modified locally". For example, the etag will be the original etag, rather than the one associated with the updated dataset. To avoid this causing confusion, we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method as the new, self-consistent representation of the dataset.

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

// This example modifies the in-memory resource in the BigQueryDataset,
// and then applies that change in the server. Alternatively, pass a Dataset
// into the Update method.
dataset.Resource.FriendlyName = "Updated dataset";
BigQueryDataset updated = dataset.Update();

Console.WriteLine($"Updated dataset friendly name: {updated.Resource.FriendlyName}");

UpdateAsync(Dataset, UpdateDatasetOptions, CancellationToken)

public Task<BigQueryDataset> UpdateAsync(Dataset resource = null, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously updates this dataset to match the specified resource.

Parameters
Name Description
resource Dataset

The resource to update with. If null, the Resource property is used.

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

This method delegates to UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, CancellationToken). A simple way of updating the dataset is to modify Resource and then call this method with no arguments. This is convenient, but it's important to understand that modifying Resource in this way leaves this object in an unusual state - it represents "the dataset as it was when fetched, but then modified locally". For example, the etag will be the original etag, rather than the one associated with the updated dataset. To avoid this causing confusion, we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method as the new, self-consistent representation of the dataset.

Example

See Update for a synchronous example.

UploadAvro(string, TableSchema, Stream, UploadAvroOptions)

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

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

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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 BigQueryClient.UploadAvro for an example using BigQueryClient.

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

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

Asynchronously uploads a stream of Avro data to a table. This method just creates a TableReference and delegates to UploadAvroAsync(TableReference, TableSchema, Stream, UploadAvroOptions, CancellationToken).

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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 BigQueryClient.UploadAvro for an example using BigQueryClient.

UploadCsv(string, TableSchema, Stream, UploadCsvOptions)

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

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

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadCsv for an example using BigQueryClient.

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

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

Asynchronously uploads a stream of CSV data to a table. This method just creates a TableReference and delegates to UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, CancellationToken).

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadCsvAsync for an example using BigQueryClient.

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

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

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

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadJson for an example using BigQueryClient.

UploadJson(string, TableSchema, Stream, UploadJsonOptions)

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

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

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadJson for an example using BigQueryClient.

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

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

Asynchronously uploads a stream of JSON data to a table. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, IEnumerable<string>, UploadJsonOptions, CancellationToken).

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadJsonAsync for an example using BigQueryClient.

UploadJsonAsync(string, TableSchema, Stream, UploadJsonOptions, CancellationToken)

public Task<BigQueryJob> UploadJsonAsync(string tableId, TableSchema schema, Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of JSON data to a table. This method just creates a TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, CancellationToken).

Parameters
Name Description
tableId string

The table ID. Must not be null.

schema TableSchema

The schema of the data. May be null if the table already exists, in which case the table schema will be fetched and used.

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.

Example

See BigQueryClient.UploadJsonAsync for an example using BigQueryClient.

UploadOrc(string, Stream, UploadOrcOptions)

public BigQueryJob UploadOrc(string tableId, Stream input, UploadOrcOptions options = null)

Uploads a stream of ORC data to a table. This method just creates a TableReference and delegates to UploadOrc(TableReference, Stream, UploadOrcOptions).

Parameters
Name Description
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 BigQueryClient.UploadOrc for an example using BigQueryClient.

UploadOrcAsync(string, Stream, UploadOrcOptions, CancellationToken)

public Task<BigQueryJob> UploadOrcAsync(string tableId, Stream input, UploadOrcOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of ORC data to a table. This method just creates a TableReference and delegates to UploadOrcAsync(TableReference, Stream, UploadOrcOptions, CancellationToken).

Parameters
Name Description
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 BigQueryClient.UploadOrc for an example using BigQueryClient.

UploadParquet(string, Stream, UploadParquetOptions)

public BigQueryJob UploadParquet(string tableId, Stream input, UploadParquetOptions options = null)

Uploads a stream of Parquet data to a table. This method just creates a TableReference and delegates to UploadParquet(TableReference, Stream, UploadParquetOptions).

Parameters
Name Description
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 BigQueryClient.UploadParquet for an example using BigQueryClient.

UploadParquetAsync(string, Stream, UploadParquetOptions, CancellationToken)

public Task<BigQueryJob> UploadParquetAsync(string tableId, Stream input, UploadParquetOptions options = null, CancellationToken cancellationToken = default)

Asynchronously uploads a stream of Parquet data to a table. This method just creates a TableReference and delegates to UploadParquetAsync(TableReference, Stream, UploadParquetOptions, CancellationToken).

Parameters
Name Description
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 BigQueryClient.UploadParquet for an example using BigQueryClient.