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 TypeMethodDescriptionvoid
createDataset
(String projectId, String datasetId, @Nullable String location, @Nullable String description, @Nullable Long defaultTableExpirationMs) Create aDataset
with the givenlocation
,description
and default expiration time for tables in the dataset (ifnull
, tables don't expire).void
createTable
(Table table) Creates the specified table if it does not exist.void
deleteDataset
(String projectId, String datasetId) Deletes the dataset specified by the datasetId value.void
deleteTable
(TableReference tableRef) Deletes the table specified by tableId from the dataset.getDataset
(String projectId, String datasetId) Gets the specifiedDataset
resource by dataset ID.getTable
(TableReference tableRef) Gets the specifiedTable
resource by table ID.getTable
(TableReference tableRef, List<String> selectedFields) getTable
(TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) <T> long
insertAll
(TableReference ref, List<FailsafeValueInSingleWindow<TableRow, TableRow>> rowList, @Nullable List<String> insertIdList, InsertRetryPolicy retryPolicy, List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, List<ValueInSingleWindow<TableRow>> successfulRows) InsertsTableRows
with the specified insertIds if not null.boolean
isTableEmpty
(TableReference tableRef) Returns true if the table is empty.patchTableDescription
(TableReference tableReference, @Nullable String tableDescription) Patch BigQueryTable
description.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
getTable
Gets the specifiedTable
resource by table ID.Returns null if the table is not found.
- Throws:
InterruptedException
IOException
-
getTable
@Nullable Table getTable(TableReference tableRef, List<String> selectedFields) throws InterruptedException, IOException - Throws:
InterruptedException
IOException
-
getTable
@Nullable Table getTable(TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) throws InterruptedException, IOException - Throws:
InterruptedException
IOException
-
createTable
Creates the specified table if it does not exist.- Throws:
InterruptedException
IOException
-
deleteTable
Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.- Throws:
IOException
InterruptedException
-
isTableEmpty
Returns true if the table is empty.- Throws:
IOException
- if the table is not found.InterruptedException
-
getDataset
Gets the specifiedDataset
resource by dataset ID.- Throws:
IOException
InterruptedException
-
createDataset
void createDataset(String projectId, String datasetId, @Nullable String location, @Nullable String description, @Nullable Long defaultTableExpirationMs) throws IOException, InterruptedException Create aDataset
with the givenlocation
,description
and default expiration time for tables in the dataset (ifnull
, tables don't expire).- Throws:
IOException
InterruptedException
-
deleteDataset
Deletes the dataset specified by the datasetId value.Before you can delete a dataset, you must delete all its tables.
- Throws:
IOException
InterruptedException
-
insertAll
<T> long insertAll(TableReference ref, List<FailsafeValueInSingleWindow<TableRow, TableRow>> rowList, @Nullable List<String> insertIdList, InsertRetryPolicy retryPolicy, List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, List<ValueInSingleWindow<TableRow>> successfulRows) throws IOException, InterruptedExceptionInsertsTableRows
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
.- Throws:
IOException
InterruptedException
-
patchTableDescription
Table patchTableDescription(TableReference tableReference, @Nullable String tableDescription) throws IOException, InterruptedException Patch BigQueryTable
description.- Throws:
IOException
InterruptedException
-