Interface BigQueryServices.DatasetService
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BigQueryServicesImpl.DatasetServiceImpl,FakeDatasetService
- Enclosing interface:
BigQueryServices
An interface to get, create and delete Cloud BigQuery datasets and tables.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateDataset(String projectId, String datasetId, @Nullable String location, @Nullable String description, @Nullable Long defaultTableExpirationMs) Create aDatasetwith the givenlocation,descriptionand default expiration time for tables in the dataset (ifnull, tables don't expire).voidcreateTable(com.google.api.services.bigquery.model.Table table) Creates the specified table if it does not exist.voiddeleteDataset(String projectId, String datasetId) Deletes the dataset specified by the datasetId value.voiddeleteTable(com.google.api.services.bigquery.model.TableReference tableRef) Deletes the table specified by tableId from the dataset.com.google.api.services.bigquery.model.DatasetgetDataset(String projectId, String datasetId) Gets the specifiedDatasetresource by dataset ID.@Nullable com.google.api.services.bigquery.model.TablegetTable(com.google.api.services.bigquery.model.TableReference tableRef) Gets the specifiedTableresource by table ID.@Nullable com.google.api.services.bigquery.model.TablegetTable(com.google.api.services.bigquery.model.TableReference tableRef, List<String> selectedFields) @Nullable com.google.api.services.bigquery.model.TablegetTable(com.google.api.services.bigquery.model.TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) <T> longinsertAll(com.google.api.services.bigquery.model.TableReference ref, List<FailsafeValueInSingleWindow<com.google.api.services.bigquery.model.TableRow, com.google.api.services.bigquery.model.TableRow>> rowList, @Nullable List<String> insertIdList, InsertRetryPolicy retryPolicy, List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, List<ValueInSingleWindow<com.google.api.services.bigquery.model.TableRow>> successfulRows) InsertsTableRowswith the specified insertIds if not null.booleanisTableEmpty(com.google.api.services.bigquery.model.TableReference tableRef) Returns true if the table is empty.com.google.api.services.bigquery.model.TablepatchTableDescription(com.google.api.services.bigquery.model.TableReference tableReference, @Nullable String tableDescription) Patch BigQueryTabledescription.com.google.api.services.bigquery.model.TablepatchTableSchema(com.google.api.services.bigquery.model.TableReference tableReference, com.google.api.services.bigquery.model.TableSchema newSchema) Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
getTable
@Nullable com.google.api.services.bigquery.model.Table getTable(com.google.api.services.bigquery.model.TableReference tableRef) throws InterruptedException, IOException Gets the specifiedTableresource by table ID.Returns null if the table is not found.
- Throws:
InterruptedExceptionIOException
-
getTable
@Nullable com.google.api.services.bigquery.model.Table getTable(com.google.api.services.bigquery.model.TableReference tableRef, List<String> selectedFields) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
getTable
@Nullable com.google.api.services.bigquery.model.Table getTable(com.google.api.services.bigquery.model.TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
createTable
void createTable(com.google.api.services.bigquery.model.Table table) throws InterruptedException, IOException Creates the specified table if it does not exist.- Throws:
InterruptedExceptionIOException
-
deleteTable
void deleteTable(com.google.api.services.bigquery.model.TableReference tableRef) throws IOException, InterruptedException Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.- Throws:
IOExceptionInterruptedException
-
isTableEmpty
boolean isTableEmpty(com.google.api.services.bigquery.model.TableReference tableRef) throws IOException, InterruptedException Returns true if the table is empty.- Throws:
IOException- if the table is not found.InterruptedException
-
getDataset
com.google.api.services.bigquery.model.Dataset getDataset(String projectId, String datasetId) throws IOException, InterruptedException Gets the specifiedDatasetresource by dataset ID.- Throws:
IOExceptionInterruptedException
-
createDataset
void createDataset(String projectId, String datasetId, @Nullable String location, @Nullable String description, @Nullable Long defaultTableExpirationMs) throws IOException, InterruptedException Create aDatasetwith the givenlocation,descriptionand default expiration time for tables in the dataset (ifnull, tables don't expire).- Throws:
IOExceptionInterruptedException
-
deleteDataset
Deletes the dataset specified by the datasetId value.Before you can delete a dataset, you must delete all its tables.
- Throws:
IOExceptionInterruptedException
-
insertAll
<T> long insertAll(com.google.api.services.bigquery.model.TableReference ref, List<FailsafeValueInSingleWindow<com.google.api.services.bigquery.model.TableRow, com.google.api.services.bigquery.model.TableRow>> rowList, @Nullable List<String> insertIdList, InsertRetryPolicy retryPolicy, List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, List<ValueInSingleWindow<com.google.api.services.bigquery.model.TableRow>> successfulRows) throws IOException, InterruptedExceptionInsertsTableRowswith 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.- Throws:
IOExceptionInterruptedException
-
patchTableDescription
com.google.api.services.bigquery.model.Table patchTableDescription(com.google.api.services.bigquery.model.TableReference tableReference, @Nullable String tableDescription) throws IOException, InterruptedException Patch BigQueryTabledescription.- Throws:
IOExceptionInterruptedException
-
patchTableSchema
com.google.api.services.bigquery.model.Table patchTableSchema(com.google.api.services.bigquery.model.TableReference tableReference, com.google.api.services.bigquery.model.TableSchema newSchema) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-