Class BigQueryServicesImpl.DatasetServiceImpl
- All Implemented Interfaces:
AutoCloseable,BigQueryServices.DatasetService
- Enclosing class:
BigQueryServicesImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.beam.sdk.io.gcp.bigquery.BigQueryServices.DatasetService
BigQueryServices.DatasetService.TableMetadataView -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcreateDataset(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(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(TableReference tableRef) Deletes the table specified by tableId from the dataset.getDataset(String projectId, String datasetId) Gets the specifiedDatasetresource by dataset ID.protected static @Nullable GoogleJsonError.ErrorInfogetTable(TableReference tableRef) Gets the specifiedTableresource by table ID.getTable(TableReference tableRef, List<String> selectedFields) getTable(TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) <T> longinsertAll(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) InsertsTableRowswith the specified insertIds if not null.booleanisTableEmpty(TableReference tableRef) Returns true if the table is empty.patchTableDescription(TableReference tableReference, @Nullable String tableDescription) Patch BigQueryTabledescription.
-
Constructor Details
-
DatasetServiceImpl
-
-
Method Details
-
getTable
Gets the specifiedTableresource by table ID.Returns null if the table is not found.
Tries executing the RPC for at most
MAX_RPC_RETRIEStimes until it succeeds.- Specified by:
getTablein interfaceBigQueryServices.DatasetService- Throws:
IOException- if it exceedsMAX_RPC_RETRIESattempts.InterruptedException
-
getTable
public @Nullable Table getTable(TableReference tableRef, List<String> selectedFields) throws IOException, InterruptedException - Specified by:
getTablein interfaceBigQueryServices.DatasetService- Throws:
IOExceptionInterruptedException
-
getTable
public @Nullable Table getTable(TableReference tableRef, List<String> selectedFields, BigQueryServices.DatasetService.TableMetadataView view) throws IOException, InterruptedException - Specified by:
getTablein interfaceBigQueryServices.DatasetService- Throws:
IOExceptionInterruptedException
-
createTable
Creates the specified table if it does not exist.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.
- Specified by:
createTablein interfaceBigQueryServices.DatasetService- Throws:
IOException- if other error than already existing table occurs.InterruptedException
-
deleteTable
Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.Tries executing the RPC for at most
MAX_RPC_RETRIEStimes until it succeeds.- Specified by:
deleteTablein interfaceBigQueryServices.DatasetService- Throws:
IOException- if it exceedsMAX_RPC_RETRIESattempts.InterruptedException
-
isTableEmpty
Description copied from interface:BigQueryServices.DatasetServiceReturns true if the table is empty.- Specified by:
isTableEmptyin interfaceBigQueryServices.DatasetService- Throws:
IOException- if the table is not found.InterruptedException
-
getDataset
public Dataset getDataset(String projectId, String datasetId) throws IOException, InterruptedException Gets the specifiedDatasetresource by dataset ID.Tries executing the RPC for at most
MAX_RPC_RETRIEStimes until it succeeds.- Specified by:
getDatasetin interfaceBigQueryServices.DatasetService- Throws:
IOException- if it exceedsMAX_RPC_RETRIESattempts.InterruptedException
-
createDataset
public 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).Tries executing the RPC for at most
MAX_RPC_RETRIEStimes until it succeeds.- Specified by:
createDatasetin interfaceBigQueryServices.DatasetService- Throws:
IOException- if it exceedsMAX_RPC_RETRIESattempts.InterruptedException
-
deleteDataset
public void deleteDataset(String projectId, String datasetId) throws IOException, InterruptedException Deletes the dataset specified by the datasetId value.Before you can delete a dataset, you must delete all its tables.
Tries executing the RPC for at most
MAX_RPC_RETRIEStimes until it succeeds.- Specified by:
deleteDatasetin interfaceBigQueryServices.DatasetService- Throws:
IOException- if it exceedsMAX_RPC_RETRIESattempts.InterruptedException
-
insertAll
public <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, InterruptedExceptionDescription copied from interface:BigQueryServices.DatasetServiceInsertsTableRowswith 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.- Specified by:
insertAllin interfaceBigQueryServices.DatasetService- Throws:
IOExceptionInterruptedException
-
getErrorInfo
-
patchTableDescription
public Table patchTableDescription(TableReference tableReference, @Nullable String tableDescription) throws IOException, InterruptedException Description copied from interface:BigQueryServices.DatasetServicePatch BigQueryTabledescription.- Specified by:
patchTableDescriptionin interfaceBigQueryServices.DatasetService- Throws:
IOExceptionInterruptedException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-