public sealed class BigQueryTable : IFormattable
A table within a BigQuery dataset.
Implements
IFormattableNamespace
Google.Cloud.BigQuery.V2Assembly
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 table-oriented operations.
Constructors
BigQueryTable(BigQueryClient, Table)
public BigQueryTable(BigQueryClient client, Table resource)
Constructs a new table.
Parameters | |
---|---|
Name | Description |
client | BigQueryClient The client to use for operations on the table. Must not be null. |
resource | Google.Apis.Bigquery.v2.Data.Table The REST-ful resource representing the table. Must not be null. |
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 table in a string form of project.dataset.table
.
Property Value | |
---|---|
Type | Description |
String |
Reference
public TableReference Reference { get; }
The fully-qualified identifier for the table, as an object which can be used for other operations within this API.
Property Value | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.TableReference |
The properties within the reference can be used to determine the project ID, dataset ID and table ID components.
Resource
public Table Resource { get; }
The underlying REST-ful resource for the table.
Property Value | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.Table |
The data within the resource may be incomplete, depending on how it was obtained. (ListTables operations return less data than GetTable operations.)
Schema
public TableSchema Schema { get; }
The schema of this table, if known. Schemas are not retrieved when listing the tables within a dataset,
so the value of this property can be null
.
Property Value | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.TableSchema |
Methods
CreateCopyJob(TableReference, CreateCopyJobOptions)
public BigQueryJob CreateCopyJob(TableReference destination, CreateCopyJobOptions options = null)
Creates a job to copy data from this table to another. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateCopyJob(TableReference, TableReference, CreateCopyJobOptions).
Parameters | |
---|---|
Name | Description |
destination | Google.Apis.Bigquery.v2.Data.TableReference The destination table to copy to. Must not be null. |
options | CreateCopyJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryJob | The job created for the copy operation. |
This method only allows one table (this one) to be used as the source table. To copy multiple tables to one destination table, use CreateCopyJob(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions).
See BigQueryClient.CreateCopyJob for an example using BigQueryClient.
CreateCopyJobAsync(TableReference, CreateCopyJobOptions, CancellationToken)
public Task<BigQueryJob> CreateCopyJobAsync(TableReference destination, CreateCopyJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a job to copy data from this table to another. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateCopyJobAsync(TableReference, TableReference, CreateCopyJobOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
destination | Google.Apis.Bigquery.v2.Data.TableReference The destination table to copy to. Must not be null. |
options | CreateCopyJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is the job created for the copy operation. |
This method only allows one table (this one) to be used as the source table. To copy multiple tables to one destination table, use CreateCopyJobAsync(IEnumerable<TableReference>, TableReference, CreateCopyJobOptions, CancellationToken).
See BigQueryClient.CreateCopyJobAsync for an example using BigQueryClient.
CreateExtractJob(IEnumerable<String>, CreateExtractJobOptions)
public BigQueryJob CreateExtractJob(IEnumerable<string> destinationUris, CreateExtractJobOptions options = null)
Creates a job to extract data from this table to Google Cloud Storage. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateExtractJob(TableReference, IEnumerable<String>, CreateExtractJobOptions). See the BigQuery documentation for more information on extract jobs.
Parameters | |
---|---|
Name | Description |
destinationUris | IEnumerable<String> The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty. |
options | CreateExtractJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryJob | The job created for the extract operation. |
See BigQueryClient.CreateExtractJob for an example using BigQueryClient.
CreateExtractJob(String, CreateExtractJobOptions)
public BigQueryJob CreateExtractJob(string destinationUri, CreateExtractJobOptions options = null)
Creates a job to extract data from this table to Google Cloud Storage. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateExtractJob(TableReference, String, CreateExtractJobOptions). See the BigQuery documentation for more information on extract jobs.
Parameters | |
---|---|
Name | Description |
destinationUri | String The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null. |
options | CreateExtractJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryJob | The job created for the extract operation. |
See BigQueryClient.CreateExtractJob for an example using BigQueryClient.
CreateExtractJobAsync(IEnumerable<String>, CreateExtractJobOptions, CancellationToken)
public Task<BigQueryJob> CreateExtractJobAsync(IEnumerable<string> destinationUris, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a job to extract data from this table to Google Cloud Storage. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateExtractJobAsync(TableReference, IEnumerable<String>, CreateExtractJobOptions, CancellationToken). See the BigQuery documentation for more information on extract jobs.
Parameters | |
---|---|
Name | Description |
destinationUris | IEnumerable<String> The Google Cloud Storage URIs (possibly including a wildcard) to extract the data to. Must not be null or empty. |
options | CreateExtractJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is the job created for the extract operation. |
See BigQueryClient.CreateExtractJobAsync for an example using BigQueryClient.
CreateExtractJobAsync(String, CreateExtractJobOptions, CancellationToken)
public Task<BigQueryJob> CreateExtractJobAsync(string destinationUri, CreateExtractJobOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a job to extract data from this table to Google Cloud Storage. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to CreateExtractJobAsync(TableReference, String, CreateExtractJobOptions, CancellationToken). See the BigQuery documentation for more information on extract jobs.
Parameters | |
---|---|
Name | Description |
destinationUri | String The Google Cloud Storage URI (possibly including a wildcard) to extract the data to. Must not be null. |
options | CreateExtractJobOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is the job created for the extract operation. |
See BigQueryClient.CreateExtractJobAsync for an example using BigQueryClient.
Delete(DeleteTableOptions)
public void Delete(DeleteTableOptions options = null)
Deletes this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to DeleteTable(TableReference, DeleteTableOptions).
Parameter | |
---|---|
Name | Description |
options | DeleteTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
See BigQueryClient.DeleteTable for an example using BigQueryClient.
DeleteAsync(DeleteTableOptions, CancellationToken)
public Task DeleteAsync(DeleteTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously deletes this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to DeleteTableAsync(TableReference, DeleteTableOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
options | DeleteTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous operation. |
See BigQueryClient.DeleteTableAsync for an example using BigQueryClient.
GetIamPolicy(GetTableIamPolicyOptions)
public Policy GetIamPolicy(GetTableIamPolicyOptions options = null)
Gets the IAM policy applied to this table.
Parameter | |
---|---|
Name | Description |
options | GetTableIamPolicyOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.Policy | The IAM policy. |
This method delegates to GetTableIamPolicy(TableReference, GetTableIamPolicyOptions).
GetIamPolicyAsync(GetTableIamPolicyOptions, CancellationToken)
public Task<Policy> GetIamPolicyAsync(GetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously gets the IAM policy applied to this table.
Parameters | |
---|---|
Name | Description |
options | GetTableIamPolicyOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<Google.Apis.Bigquery.v2.Data.Policy> | A task representing the asynchronous operation. When complete, the result is the IAM policy obtained. |
This method delegates to GetTableIamPolicyAsync(TableReference, GetTableIamPolicyOptions, CancellationToken).
InsertRow(BigQueryInsertRow, InsertOptions)
public BigQueryInsertResults InsertRow(BigQueryInsertRow row, InsertOptions options = null)
Inserts a single row of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRow(TableReference, BigQueryInsertRow, InsertOptions).
Parameters | |
---|---|
Name | Description |
row | BigQueryInsertRow The data to insert. Must not be null. |
options | InsertOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryInsertResults | An insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRow for an example using BigQueryClient.
InsertRowAsync(BigQueryInsertRow, InsertOptions, CancellationToken)
public Task<BigQueryInsertResults> InsertRowAsync(BigQueryInsertRow row, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously inserts a single row of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRowAsync(TableReference, BigQueryInsertRow, InsertOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
row | BigQueryInsertRow The data to insert. Must not be null. |
options | InsertOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryInsertResults> | A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRow for an example using BigQueryClient.
InsertRows(BigQueryInsertRow[])
public BigQueryInsertResults InsertRows(params BigQueryInsertRow[] rows)
Inserts all the given rows of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRows(TableReference, BigQueryInsertRow[]).
Parameter | |
---|---|
Name | Description |
rows | BigQueryInsertRow[] The rows to insert. Must not be null or contain null entries. |
Returns | |
---|---|
Type | Description |
BigQueryInsertResults | An insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRows for an example using BigQueryClient.
InsertRows(IEnumerable<BigQueryInsertRow>, InsertOptions)
public BigQueryInsertResults InsertRows(IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null)
Inserts all the given rows of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRows(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions).
Parameters | |
---|---|
Name | Description |
rows | IEnumerable<BigQueryInsertRow> The rows to insert. Must not be null or contain null entries. |
options | InsertOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryInsertResults | An insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRows for an example using BigQueryClient.
InsertRowsAsync(BigQueryInsertRow[])
public Task<BigQueryInsertResults> InsertRowsAsync(params BigQueryInsertRow[] rows)
Asynchronously inserts all the given rows of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRowsAsync(TableReference, BigQueryInsertRow[]).
Parameter | |
---|---|
Name | Description |
rows | BigQueryInsertRow[] The rows to insert. Must not be null or contain null entries. |
Returns | |
---|---|
Type | Description |
Task<BigQueryInsertResults> | A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRowAsync for an example using BigQueryClient.
InsertRowsAsync(IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken)
public Task<BigQueryInsertResults> InsertRowsAsync(IEnumerable<BigQueryInsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously inserts all the given rows of data into this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to InsertRowsAsync(TableReference, IEnumerable<BigQueryInsertRow>, InsertOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
rows | IEnumerable<BigQueryInsertRow> The rows to insert. Must not be null or contain null entries. |
options | InsertOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryInsertResults> | A task representing the asynchronous operation. When complete, the result is an insert result object which contains information on insert errors if any. |
See BigQueryClient.InsertRowAsync for an example using BigQueryClient.
ListRows(ListRowsOptions)
public PagedEnumerable<TableDataList, BigQueryRow> ListRows(ListRowsOptions options = null)
Lists the rows within this table, similar to a SELECT * FROM ...
query.
This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to ListRows(TableReference, TableSchema, ListRowsOptions).
Parameter | |
---|---|
Name | Description |
options | ListRowsOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<Google.Apis.Bigquery.v2.Data.TableDataList, BigQueryRow> | The results of listing the rows within the table. |
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, tableId);
PagedEnumerable<TableDataList, BigQueryRow> result = table.ListRows();
foreach (BigQueryRow row in result)
{
DateTime timestamp = (DateTime)row["game_started"];
long level = (long)row["level"];
long score = (long)row["score"];
string player = (string)row["player"];
Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})");
}
ListRowsAsync(ListRowsOptions)
public PagedAsyncEnumerable<TableDataList, BigQueryRow> ListRowsAsync(ListRowsOptions options = null)
Asynchronously lists the rows within this table, similar to a SELECT * FROM ...
query.
This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to ListRowsAsync(TableReference, TableSchema, ListRowsOptions).
Parameter | |
---|---|
Name | Description |
options | ListRowsOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<Google.Apis.Bigquery.v2.Data.TableDataList, BigQueryRow> | An asynchronous sequence of the rows within the table. |
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, tableId);
PagedAsyncEnumerable<TableDataList, BigQueryRow> result = table.ListRowsAsync();
await result.ForEachAsync(row =>
{
DateTime timestamp = (DateTime)row["game_started"];
long level = (long)row["level"];
long score = (long)row["score"];
string player = (string)row["player"];
Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})");
});
Patch(Table, Boolean, PatchTableOptions)
public BigQueryTable Patch(Table resource, bool matchETag, PatchTableOptions options = null)
Patches this table with fields in the specified resource.
Parameters | |
---|---|
Name | Description |
resource | Google.Apis.Bigquery.v2.Data.Table The resource to patch with. Must not be null. |
matchETag | Boolean If true, the etag from Resource is propagated into |
options | PatchTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryTable | The updated table. |
This method delegates to PatchTable(TableReference, Table, PatchTableOptions).
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable dataset = client.GetTable(datasetId, tableId);
// There's no ETag in this Table. The matchETag parameter in the method call
// determines whether the ETag in the original resource is propagated into the
// patch.
Table patch = new Table
{
FriendlyName = "Patched table"
};
BigQueryTable updated = dataset.Patch(patch, matchETag: true);
Console.WriteLine($"Patched table friendly name: {updated.Resource.FriendlyName}");
PatchAsync(Table, Boolean, PatchTableOptions, CancellationToken)
public Task<BigQueryTable> PatchAsync(Table resource, bool matchETag, PatchTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously patches this table with fields in the specified resource.
Parameters | |
---|---|
Name | Description |
resource | Google.Apis.Bigquery.v2.Data.Table The resource to patch with. Must not be null. |
matchETag | Boolean If true, the etag from Resource is propagated into |
options | PatchTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryTable> | A task representing the asynchronous operation. When complete, the result is the updated table. |
This method delegates to PatchTableAsync(TableReference, Table, PatchTableOptions, CancellationToken).
See Patch for a synchronous example.
SetIamPolicy(Policy, SetTableIamPolicyOptions)
public Policy SetIamPolicy(Policy policy, SetTableIamPolicyOptions options = null)
Applies the given IAM policy to this table. An update mask may be provided through options
.
Parameters | |
---|---|
Name | Description |
policy | Google.Apis.Bigquery.v2.Data.Policy The policy to apply to this table. |
options | SetTableIamPolicyOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.Policy | The resulting IAM policy after appying |
This method delegates to SetTableIamPolicy(TableReference, Policy, SetTableIamPolicyOptions).
SetIamPolicyAsync(Policy, SetTableIamPolicyOptions, CancellationToken)
public Task<Policy> SetIamPolicyAsync(Policy policy, SetTableIamPolicyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously applies the given IAM policy to this table. An update mask may be provided through options
.
Parameters | |
---|---|
Name | Description |
policy | Google.Apis.Bigquery.v2.Data.Policy The policy to apply to this table. |
options | SetTableIamPolicyOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<Google.Apis.Bigquery.v2.Data.Policy> | A task representing the asynchronous operation. When complete, the result is
the resulting IAM policy after appying |
This method delegates to SetTableIamPolicyAsync(TableReference, Policy, SetTableIamPolicyOptions, CancellationToken).
TestIamPermissions(IList<String>, TestTableIamPermissionsOptions)
public TestIamPermissionsResponse TestIamPermissions(IList<string> permissions, TestTableIamPermissionsOptions options = null)
Tests whether the caller has the given permissions for this table.
Parameters | |
---|---|
Name | Description |
permissions | IList<String> The table permissions to test for this caller. |
options | TestTableIamPermissionsOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
Google.Apis.Bigquery.v2.Data.TestIamPermissionsResponse | A response object that contains a list of permissions which is the subset of |
This method delegates to TestTableIamPermissions(TableReference, IList<String>, TestTableIamPermissionsOptions).
TestIamPermissionsAsync(IList<String>, TestTableIamPermissionsOptions, CancellationToken)
public Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IList<string> permissions, TestTableIamPermissionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously tests whether the caller has the given permissions for this table.
Parameters | |
---|---|
Name | Description |
permissions | IList<String> The table permissions to test for this caller. |
options | TestTableIamPermissionsOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<Google.Apis.Bigquery.v2.Data.TestIamPermissionsResponse> | A task representing the asynchronous operation. When complete, the result is
a response object that contains a list of permissions which is the subset of |
This method delegates to TestTableIamPermissionsAsync(TableReference, IList<String>, TestTableIamPermissionsOptions, CancellationToken).
ToLegacySqlFormat()
public string ToLegacySqlFormat()
Returns the fully-qualified ID of the table in Legacy SQL format. The Legacy SQL format uses square brackets instead of backticks to surround the ID, and uses a colon instead of a period between the project ID and the dataset ID.
Returns | |
---|---|
Type | Description |
String | The fully-qualified ID of the table in Legacy SQL format. |
ToString()
public override string ToString()
Returns the fully-qualified ID of the table in backticks.
Returns | |
---|---|
Type | Description |
String |
This is designed to facilitate constructing queries by simply including the table in the string.
ToString(String, IFormatProvider)
public string ToString(string format, IFormatProvider formatProvider)
Returns the fully-qualified ID of the table, in either the Standard SQL or Legacy SQL format.
Parameters | |
---|---|
Name | Description |
format | String If this has a value of |
formatProvider | IFormatProvider Ignored. |
Returns | |
---|---|
Type | Description |
String | The formatted table name. |
This method allows the Legacy SQL format to be used simply within an interpolated string.
Update(Table, UpdateTableOptions)
public BigQueryTable Update(Table resource = null, UpdateTableOptions options = null)
Updates this table to match the specified resource.
Parameters | |
---|---|
Name | Description |
resource | Google.Apis.Bigquery.v2.Data.Table The resource to update with. If null, the Resource property is used. |
options | UpdateTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
Returns | |
---|---|
Type | Description |
BigQueryTable | The updated table. |
This method delegates to UpdateTable(TableReference, Table, UpdateTableOptions). A simple way of updating the table 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 table 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 table. 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 table.
BigQueryClient client = BigQueryClient.Create(projectId);
BigQueryTable table = client.GetTable(datasetId, tableId);
// 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.
table.Resource.FriendlyName = "Updated table";
BigQueryTable updated = table.Update();
Console.WriteLine($"Updated table friendly name: {updated.Resource.FriendlyName}");
UpdateAsync(Table, UpdateTableOptions, CancellationToken)
public Task<BigQueryTable> UpdateAsync(Table resource = null, UpdateTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously updates this table to match the specified resource.
Parameters | |
---|---|
Name | Description |
resource | Google.Apis.Bigquery.v2.Data.Table The resource to update with. If null, the Resource property is used. |
options | UpdateTableOptions The options for the operation. May be null, in which case defaults will be supplied. |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<BigQueryTable> | A task representing the asynchronous operation. When complete, the result is the updated table. |
This method delegates to UpdateTableAsync(TableReference, Table, UpdateTableOptions, CancellationToken). A simple way of updating the table 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 table 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 table. 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 table.
See Update for a synchronous example.
UploadAvro(Stream, UploadAvroOptions)
public BigQueryJob UploadAvro(Stream input, UploadAvroOptions options = null)
Uploads a stream of Avro data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadAvro(TableReference, TableSchema, Stream, UploadAvroOptions).
Parameters | |
---|---|
Name | Description |
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. |
See BigQueryClient.UploadAvro for an example using BigQueryClient.
UploadAvroAsync(Stream, UploadAvroOptions, CancellationToken)
public Task<BigQueryJob> UploadAvroAsync(Stream input, UploadAvroOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a stream of Avro data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadAvroAsync(TableReference, TableSchema, Stream, UploadAvroOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
See BigQueryClient.UploadAvro for an example using BigQueryClient.
UploadCsv(Stream, UploadCsvOptions)
public BigQueryJob UploadCsv(Stream input, UploadCsvOptions options = null)
Uploads a stream of CSV data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadCsv(TableReference, TableSchema, Stream, UploadCsvOptions).
Parameters | |
---|---|
Name | Description |
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. |
See BigQueryClient.UploadCsv for an example using BigQueryClient.
UploadCsvAsync(Stream, UploadCsvOptions, CancellationToken)
public Task<BigQueryJob> UploadCsvAsync(Stream input, UploadCsvOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a stream of CSV data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadCsvAsync(TableReference, TableSchema, Stream, UploadCsvOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
See BigQueryClient.UploadCsvAsync for an example using BigQueryClient.
UploadJson(IEnumerable<String>, UploadJsonOptions)
public BigQueryJob UploadJson(IEnumerable<string> rows, UploadJsonOptions options = null)
Uploads a sequence of JSON rows to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadJson(TableReference, TableSchema, IEnumerable<String>, UploadJsonOptions).
Parameters | |
---|---|
Name | Description |
rows | IEnumerable<String> 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. |
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.
See BigQueryClient.UploadJson for an example using BigQueryClient.
UploadJson(Stream, UploadJsonOptions)
public BigQueryJob UploadJson(Stream input, UploadJsonOptions options = null)
Uploads a stream of JSON data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadJson(TableReference, TableSchema, Stream, UploadJsonOptions).
Parameters | |
---|---|
Name | Description |
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. |
See BigQueryClient.UploadJson for an example using BigQueryClient.
UploadJsonAsync(IEnumerable<String>, UploadJsonOptions, CancellationToken)
public Task<BigQueryJob> UploadJsonAsync(IEnumerable<string> rows, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a stream of JSON data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, IEnumerable<String>, UploadJsonOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
rows | IEnumerable<String> 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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
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.
See BigQueryClient.UploadJsonAsync for an example using BigQueryClient.
UploadJsonAsync(Stream, UploadJsonOptions, CancellationToken)
public Task<BigQueryJob> UploadJsonAsync(Stream input, UploadJsonOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a sequence of JSON rows to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadJsonAsync(TableReference, TableSchema, Stream, UploadJsonOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
See BigQueryClient.UploadJsonAsync for an example using BigQueryClient.
UploadOrc(Stream, UploadOrcOptions)
public BigQueryJob UploadOrc(Stream input, UploadOrcOptions options = null)
Uploads a stream of ORC data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadOrc(TableReference, Stream, UploadOrcOptions).
Parameters | |
---|---|
Name | Description |
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. |
See BigQueryClient.UploadOrc for an example using BigQueryClient.
UploadOrcAsync(Stream, UploadOrcOptions, CancellationToken)
public Task<BigQueryJob> UploadOrcAsync(Stream input, UploadOrcOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a stream of ORC data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadOrcAsync(TableReference, Stream, UploadOrcOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
See BigQueryClient.UploadOrc for an example using BigQueryClient.
UploadParquet(Stream, UploadParquetOptions)
public BigQueryJob UploadParquet(Stream input, UploadParquetOptions options = null)
Uploads a stream of Parquet data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadParquet(TableReference, Stream, UploadParquetOptions).
Parameters | |
---|---|
Name | Description |
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. |
See BigQueryClient.UploadParquet for an example using BigQueryClient.
UploadParquetAsync(Stream, UploadParquetOptions, CancellationToken)
public Task<BigQueryJob> UploadParquetAsync(Stream input, UploadParquetOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Asynchronously uploads a stream of Parquet data to this table. This method just creates a Google.Apis.Bigquery.v2.Data.TableReference and delegates to UploadParquetAsync(TableReference, Stream, UploadParquetOptions, CancellationToken).
Parameters | |
---|---|
Name | Description |
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 |
Task<BigQueryJob> | A task representing the asynchronous operation. When complete, the result is a data upload job. |
See BigQueryClient.UploadParquet for an example using BigQueryClient.