public static class BigQueryServicesImpl.DatasetServiceImpl extends java.lang.Object implements BigQueryServices.DatasetService
BigQueryServices.DatasetService.TableMetadataView
Constructor and Description |
---|
DatasetServiceImpl(BigQueryOptions bqOptions) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsResponse> |
commitWriteStreams(java.lang.String tableUrn,
java.lang.Iterable<java.lang.String> writeStreamNames)
Commit write streams of type PENDING.
|
void |
createDataset(java.lang.String projectId,
java.lang.String datasetId,
@Nullable java.lang.String location,
@Nullable java.lang.String description,
@Nullable java.lang.Long defaultTableExpirationMs)
Create a
Dataset with the given location , description and default
expiration time for tables in the dataset (if null , tables don't expire). |
void |
createTable(Table table)
Creates the specified table if it does not exist.
|
com.google.cloud.bigquery.storage.v1.WriteStream |
createWriteStream(java.lang.String tableUrn,
com.google.cloud.bigquery.storage.v1.WriteStream.Type type)
Create a Write Stream for use with the Storage Write API.
|
void |
deleteDataset(java.lang.String projectId,
java.lang.String datasetId)
Deletes the dataset specified by the datasetId value.
|
void |
deleteTable(TableReference tableRef)
Deletes the table specified by tableId from the dataset.
|
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.FinalizeWriteStreamResponse> |
finalizeWriteStream(java.lang.String streamName)
Finalize a write stream.
|
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.FlushRowsResponse> |
flush(java.lang.String streamName,
long flushOffset)
Flush a given stream up to the given offset.
|
Dataset |
getDataset(java.lang.String projectId,
java.lang.String datasetId)
Gets the specified
Dataset resource by dataset ID. |
protected static GoogleJsonError.ErrorInfo |
getErrorInfo(java.io.IOException e) |
BigQueryServices.StreamAppendClient |
getStreamAppendClient(java.lang.String streamName,
com.google.protobuf.DescriptorProtos.DescriptorProto descriptor,
boolean useConnectionPool,
com.google.cloud.bigquery.storage.v1.AppendRowsRequest.MissingValueInterpretation missingValueInterpretation)
Create an append client for a given Storage API write stream.
|
@Nullable Table |
getTable(TableReference tableRef)
Gets the specified
Table resource by table ID. |
@Nullable Table |
getTable(TableReference tableRef,
java.util.List<java.lang.String> selectedFields) |
@Nullable Table |
getTable(TableReference tableRef,
java.util.List<java.lang.String> selectedFields,
BigQueryServices.DatasetService.TableMetadataView view) |
@Nullable com.google.cloud.bigquery.storage.v1.WriteStream |
getWriteStream(java.lang.String writeStream) |
<T> long |
insertAll(TableReference ref,
java.util.List<FailsafeValueInSingleWindow<TableRow,TableRow>> rowList,
@Nullable java.util.List<java.lang.String> insertIdList,
InsertRetryPolicy retryPolicy,
java.util.List<ValueInSingleWindow<T>> failedInserts,
ErrorContainer<T> errorContainer,
boolean skipInvalidRows,
boolean ignoreUnknownValues,
boolean ignoreInsertIds,
java.util.List<ValueInSingleWindow<TableRow>> successfulRows)
Inserts
TableRows with the specified insertIds if not null. |
boolean |
isTableEmpty(TableReference tableRef)
Returns true if the table is empty.
|
Table |
patchTableDescription(TableReference tableReference,
@Nullable java.lang.String tableDescription)
Patch BigQuery
Table description. |
public DatasetServiceImpl(BigQueryOptions bqOptions)
public @Nullable Table getTable(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
Table
resource by table ID.
Returns null if the table is not found.
Tries executing the RPC for at most MAX_RPC_RETRIES
times until it succeeds.
getTable
in interface BigQueryServices.DatasetService
java.io.IOException
- if it exceeds MAX_RPC_RETRIES
attempts.java.lang.InterruptedException
public @Nullable Table getTable(TableReference tableRef, java.util.List<java.lang.String> selectedFields) throws java.io.IOException, java.lang.InterruptedException
getTable
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public @Nullable Table getTable(TableReference tableRef, java.util.List<java.lang.String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) throws java.io.IOException, java.lang.InterruptedException
getTable
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public void createTable(Table table) throws java.lang.InterruptedException, java.io.IOException
If a table with the same name already exists in the dataset, the function simply returns. In such a case, the existing table doesn't necessarily have the same schema as specified by the parameter.
createTable
in interface BigQueryServices.DatasetService
java.io.IOException
- if other error than already existing table occurs.java.lang.InterruptedException
public void deleteTable(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
Tries executing the RPC for at most MAX_RPC_RETRIES
times until it succeeds.
deleteTable
in interface BigQueryServices.DatasetService
java.io.IOException
- if it exceeds MAX_RPC_RETRIES
attempts.java.lang.InterruptedException
public boolean isTableEmpty(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
isTableEmpty
in interface BigQueryServices.DatasetService
java.io.IOException
- if the table is not found.java.lang.InterruptedException
public Dataset getDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
Dataset
resource by dataset ID.
Tries executing the RPC for at most MAX_RPC_RETRIES
times until it succeeds.
getDataset
in interface BigQueryServices.DatasetService
java.io.IOException
- if it exceeds MAX_RPC_RETRIES
attempts.java.lang.InterruptedException
public void createDataset(java.lang.String projectId, java.lang.String datasetId, @Nullable java.lang.String location, @Nullable java.lang.String description, @Nullable java.lang.Long defaultTableExpirationMs) throws java.io.IOException, java.lang.InterruptedException
Dataset
with the given location
, description
and default
expiration time for tables in the dataset (if null
, tables don't expire).
Tries executing the RPC for at most MAX_RPC_RETRIES
times until it succeeds.
createDataset
in interface BigQueryServices.DatasetService
java.io.IOException
- if it exceeds MAX_RPC_RETRIES
attempts.java.lang.InterruptedException
public void deleteDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
Before you can delete a dataset, you must delete all its tables.
Tries executing the RPC for at most MAX_RPC_RETRIES
times until it succeeds.
deleteDataset
in interface BigQueryServices.DatasetService
java.io.IOException
- if it exceeds MAX_RPC_RETRIES
attempts.java.lang.InterruptedException
public <T> long insertAll(TableReference ref, java.util.List<FailsafeValueInSingleWindow<TableRow,TableRow>> rowList, @Nullable java.util.List<java.lang.String> insertIdList, InsertRetryPolicy retryPolicy, java.util.List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, java.util.List<ValueInSingleWindow<TableRow>> successfulRows) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
TableRows
with the specified insertIds if not null.
If any insert fail permanently according to the retry policy, those rows are added to failedInserts.
Returns the total bytes count of TableRows
.
insertAll
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
protected static GoogleJsonError.ErrorInfo getErrorInfo(java.io.IOException e)
public Table patchTableDescription(TableReference tableReference, @Nullable java.lang.String tableDescription) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
Table
description.patchTableDescription
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public com.google.cloud.bigquery.storage.v1.WriteStream createWriteStream(java.lang.String tableUrn, com.google.cloud.bigquery.storage.v1.WriteStream.Type type) throws java.io.IOException
BigQueryServices.DatasetService
createWriteStream
in interface BigQueryServices.DatasetService
java.io.IOException
public @Nullable com.google.cloud.bigquery.storage.v1.WriteStream getWriteStream(java.lang.String writeStream)
getWriteStream
in interface BigQueryServices.DatasetService
public BigQueryServices.StreamAppendClient getStreamAppendClient(java.lang.String streamName, com.google.protobuf.DescriptorProtos.DescriptorProto descriptor, boolean useConnectionPool, com.google.cloud.bigquery.storage.v1.AppendRowsRequest.MissingValueInterpretation missingValueInterpretation) throws java.lang.Exception
BigQueryServices.DatasetService
getStreamAppendClient
in interface BigQueryServices.DatasetService
java.lang.Exception
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.FlushRowsResponse> flush(java.lang.String streamName, long flushOffset) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
flush
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.FinalizeWriteStreamResponse> finalizeWriteStream(java.lang.String streamName)
BigQueryServices.DatasetService
finalizeWriteStream
in interface BigQueryServices.DatasetService
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsResponse> commitWriteStreams(java.lang.String tableUrn, java.lang.Iterable<java.lang.String> writeStreamNames)
BigQueryServices.DatasetService
commitWriteStreams
in interface BigQueryServices.DatasetService
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception