Class BigQueryDataset

public sealed 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
TypeNameDescription
BigQueryClientclient

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

Datasetresource

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
TypeNameDescription
StringroutineId

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.

CreateRoutineOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
StringroutineId

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.

CreateRoutineOptionsoptions

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<BigQueryRoutine>

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
TypeNameDescription
StringtableId

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.

CreateTableOptionsoptions

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

CreateTableOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
StringtableId

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.

CreateTableOptionsoptions

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<BigQueryTable>

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(CancellationToken))

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

Parameters
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

CreateTableOptionsoptions

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<BigQueryTable>

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
TypeNameDescription
DeleteDatasetOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
DeleteDatasetOptionsoptions

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
TypeNameDescription
StringmodelId

The model ID. Must not be null.

GetModelOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
StringmodelId

The model ID. Must not be null.

GetModelOptionsoptions

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<BigQueryModel>

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
TypeNameDescription
StringmodelId

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
TypeNameDescription
StringroutineId

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.

GetRoutineOptionsgetOptions

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

CreateRoutineOptionscreateOptions

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(CancellationToken))

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
TypeNameDescription
StringroutineId

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.

GetRoutineOptionsgetOptions

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

CreateRoutineOptionscreateOptions

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
Task<BigQueryRoutine>

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
TypeNameDescription
StringtableId

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.

GetTableOptionsgetOptions

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

CreateTableOptionscreateOptions

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

GetTableOptionsgetOptions

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

CreateTableOptionscreateOptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

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.

GetTableOptionsgetOptions

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

CreateTableOptionscreateOptions

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
Task<BigQueryTable>

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

GetTableOptionsgetOptions

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

CreateTableOptionscreateOptions

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
Task<BigQueryTable>

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
TypeNameDescription
StringroutineId

The routine ID. Must not be null.

GetRoutineOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
StringroutineId

The routine ID. Must not be null.

GetRoutineOptionsoptions

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<BigQueryRoutine>

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
TypeNameDescription
StringroutineId

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

GetTableOptionsoptions

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(CancellationToken))

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

Parameters
TypeNameDescription
StringtableId

The table ID. Must not be null.

GetTableOptionsoptions

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<BigQueryTable>

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
TypeNameDescription
StringtableId

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
TypeNameDescription
ListModelsOptionsoptions

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

Returns
TypeDescription
PagedEnumerable<ListModelsResponse, BigQueryModel>

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
TypeNameDescription
ListModelsOptionsoptions

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

Returns
TypeDescription
PagedAsyncEnumerable<ListModelsResponse, BigQueryModel>

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
TypeNameDescription
ListRoutinesOptionsoptions

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

Returns
TypeDescription
PagedEnumerable<ListRoutinesResponse, BigQueryRoutine>

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
TypeNameDescription
ListRoutinesOptionsoptions

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

Returns
TypeDescription
PagedAsyncEnumerable<ListRoutinesResponse, BigQueryRoutine>

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
TypeNameDescription
ListTablesOptionsoptions

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

Returns
TypeDescription
PagedEnumerable<TableList, BigQueryTable>

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
TypeNameDescription
ListTablesOptionsoptions

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

Returns
TypeDescription
PagedAsyncEnumerable<TableList, BigQueryTable>

An asynchronous sequence of tables within this dataset.

Example

See BigQueryClient.ListTablesAsync for an example using BigQueryClient.

Patch(Dataset, Boolean, PatchDatasetOptions)

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

Patches this dataset with fields in the specified resource.

Parameters
TypeNameDescription
Datasetresource

The resource to patch with. Must not be null.

BooleanmatchETag

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

PatchDatasetOptionsoptions

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, Boolean, PatchDatasetOptions, CancellationToken)

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

Asynchronously patches this dataset with fields in the specified resource.

Parameters
TypeNameDescription
Datasetresource

The resource to patch with. Must not be null.

BooleanmatchETag

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

PatchDatasetOptionsoptions

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<BigQueryDataset>

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
TypeNameDescription
Datasetresource

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

UpdateDatasetOptionsoptions

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(CancellationToken))

Asynchronously updates this dataset to match the specified resource.

Parameters
TypeNameDescription
Datasetresource

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

UpdateDatasetOptionsoptions

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<BigQueryDataset>

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadAvroOptionsoptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadAvroOptionsoptions

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<BigQueryJob>

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadCsvOptionsoptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadCsvOptionsoptions

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<BigQueryJob>

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

IEnumerable<String>rows

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

UploadJsonOptionsoptions

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadJsonOptionsoptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

IEnumerable<String>rows

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

UploadJsonOptionsoptions

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<BigQueryJob>

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

TableSchemaschema

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

Streaminput

The stream of input data. Must not be null.

UploadJsonOptionsoptions

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<BigQueryJob>

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

Streaminput

The stream of input data. Must not be null.

UploadOrcOptionsoptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

Streaminput

The stream of input data. Must not be null.

UploadOrcOptionsoptions

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<BigQueryJob>

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

Streaminput

The stream of input data. Must not be null.

UploadParquetOptionsoptions

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(CancellationToken))

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
TypeNameDescription
StringtableId

The table ID. Must not be null.

Streaminput

The stream of input data. Must not be null.

UploadParquetOptionsoptions

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<BigQueryJob>

A task representing the asynchronous operation. When complete, the result is a data upload job.

Example

See BigQueryClient.UploadParquet for an example using BigQueryClient.