Google BigQuery v2 API - Class BigQueryDataset (3.6.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
NameDescription
clientBigQueryClient

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

resourceDataset

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
TypeDescription
string

Reference

public DatasetReference Reference { get; }

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

Property Value
TypeDescription
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
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

routineRoutine

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.

optionsCreateRoutineOptions

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

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

routineRoutine

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.

optionsCreateRoutineOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

tableTable

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.

optionsCreateTableOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

optionsCreateTableOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

tableTable

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.

optionsCreateTableOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

optionsCreateTableOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
optionsDeleteDatasetOptions

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
NameDescription
optionsDeleteDatasetOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
modelIdstring

The model ID. Must not be null.

optionsGetModelOptions

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

Returns
TypeDescription
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
NameDescription
modelIdstring

The model ID. Must not be null.

optionsGetModelOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
modelIdstring

The model ID. Must not be null.

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

routineRoutine

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.

getOptionsGetRoutineOptions

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

createOptionsCreateRoutineOptions

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

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

routineRoutine

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.

getOptionsGetRoutineOptions

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

createOptionsCreateRoutineOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

tableTable

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.

getOptionsGetTableOptions

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

createOptionsCreateTableOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

getOptionsGetTableOptions

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

createOptionsCreateTableOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

tableTable

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.

getOptionsGetTableOptions

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

createOptionsCreateTableOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

getOptionsGetTableOptions

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

createOptionsCreateTableOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

optionsGetRoutineOptions

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

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

optionsGetRoutineOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
routineIdstring

The routine ID. Must not be null.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

optionsGetTableOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

optionsGetTableOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

Returns
TypeDescription
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
NameDescription
optionsListModelsOptions

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

Returns
TypeDescription
PagedEnumerableGoogle.Apis.Bigquery.v2.Data.ListModelsResponseBigQueryModel

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
NameDescription
optionsListModelsOptions

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

Returns
TypeDescription
PagedAsyncEnumerableGoogle.Apis.Bigquery.v2.Data.ListModelsResponseBigQueryModel

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
NameDescription
optionsListRoutinesOptions

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

Returns
TypeDescription
PagedEnumerableGoogle.Apis.Bigquery.v2.Data.ListRoutinesResponseBigQueryRoutine

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
NameDescription
optionsListRoutinesOptions

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

Returns
TypeDescription
PagedAsyncEnumerableGoogle.Apis.Bigquery.v2.Data.ListRoutinesResponseBigQueryRoutine

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
NameDescription
optionsListTablesOptions

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

Returns
TypeDescription
PagedEnumerableGoogle.Apis.Bigquery.v2.Data.TableListBigQueryTable

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
NameDescription
optionsListTablesOptions

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

Returns
TypeDescription
PagedAsyncEnumerableGoogle.Apis.Bigquery.v2.Data.TableListBigQueryTable

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
NameDescription
resourceDataset

The resource to patch with. Must not be null.

matchETagbool

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

optionsPatchDatasetOptions

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

Returns
TypeDescription
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
NameDescription
resourceDataset

The resource to patch with. Must not be null.

matchETagbool

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

optionsPatchDatasetOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
resourceDataset

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

optionsUpdateDatasetOptions

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

Returns
TypeDescription
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
NameDescription
resourceDataset

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

optionsUpdateDatasetOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadAvroOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadAvroOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadCsvOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadCsvOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

rowsIEnumerablestring

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

optionsUploadJsonOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadJsonOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

rowsIEnumerablestring

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

optionsUploadJsonOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

schemaTableSchema

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

inputStream

The stream of input data. Must not be null.

optionsUploadJsonOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

inputStream

The stream of input data. Must not be null.

optionsUploadOrcOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

inputStream

The stream of input data. Must not be null.

optionsUploadOrcOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

inputStream

The stream of input data. Must not be null.

optionsUploadParquetOptions

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

Returns
TypeDescription
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
NameDescription
tableIdstring

The table ID. Must not be null.

inputStream

The stream of input data. Must not be null.

optionsUploadParquetOptions

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

cancellationTokenCancellationToken

The token to monitor for cancellation requests.

Returns
TypeDescription
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.