use of com.google.cloud.bigquery.DatasetId in project java-docs-samples by GoogleCloudPlatform.
the class QuickstartSampleIT method deleteMyNewDataset.
private static final void deleteMyNewDataset() {
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
String datasetName = "my_new_dataset";
DatasetId datasetId = DatasetId.of(datasetName);
DatasetDeleteOption deleteContents = DatasetDeleteOption.deleteContents();
bigquery.delete(datasetId, deleteContents);
}
use of com.google.cloud.bigquery.DatasetId in project components by Talend.
the class BigQueryBeamRuntimeTestIT method cleanDataset.
@AfterClass
public static void cleanDataset() {
BigQuery bigquery = BigQueryConnection.createClient(createDatastore());
DatasetId datasetId = DatasetId.of(BigQueryTestConstants.PROJECT, datasetName);
bigquery.delete(datasetId, BigQuery.DatasetDeleteOption.deleteContents());
}
use of com.google.cloud.bigquery.DatasetId in project java-docs-samples by GoogleCloudPlatform.
the class QuerySampleIT method createTestDataset.
private static final void createTestDataset() {
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
DatasetId datasetId = DatasetId.of(TEST_DATASET);
bigquery.create(DatasetInfo.newBuilder(datasetId).build());
}
use of com.google.cloud.bigquery.DatasetId in project presto by prestodb.
the class BigQueryClient method createDestinationTable.
protected TableId createDestinationTable(TableId tableId) {
String project = viewMaterializationProject.orElse(tableId.getProject());
String dataset = viewMaterializationDataset.orElse(tableId.getDataset());
DatasetId datasetId = mapIfNeeded(project, dataset);
return TableId.of(datasetId.getProject(), datasetId.getDataset(), createTableName());
}
use of com.google.cloud.bigquery.DatasetId in project presto by prestodb.
the class BigQueryClient method listTables.
protected Iterable<Table> listTables(DatasetId datasetId, TableDefinition.Type... types) {
Set<TableDefinition.Type> allowedTypes = ImmutableSet.copyOf(types);
DatasetId bigQueryDatasetId = datasetIds.getOrDefault(datasetId, datasetId);
Iterable<Table> allTables = bigQuery.listTables(bigQueryDatasetId).iterateAll();
allTables.forEach(table -> addTableMappingIfNeeded(bigQueryDatasetId, table));
return StreamSupport.stream(allTables.spliterator(), false).filter(table -> allowedTypes.contains(table.getDefinition().getType())).collect(toImmutableList());
}
Aggregations