use of com.google.cloud.bigquery.DatasetId in project presto by prestodb.
the class BigQueryClient method addDataSetMappingIfNeeded.
private Dataset addDataSetMappingIfNeeded(Dataset dataset) {
DatasetId bigQueryDatasetId = dataset.getDatasetId();
DatasetId prestoDatasetId = DatasetId.of(bigQueryDatasetId.getProject(), bigQueryDatasetId.getDataset().toLowerCase(ENGLISH));
datasetIds.putIfAbsent(prestoDatasetId, bigQueryDatasetId);
return dataset;
}
use of com.google.cloud.bigquery.DatasetId in project components by Talend.
the class BigQueryBeamRuntimeTestIT method initDataset.
@BeforeClass
public static void initDataset() throws IOException {
BigQuery bigquery = BigQueryConnection.createClient(createDatastore());
DatasetId datasetId = DatasetId.of(BigQueryTestConstants.PROJECT, datasetName);
bigquery.create(DatasetInfo.of(datasetId));
}
use of com.google.cloud.bigquery.DatasetId in project components by Talend.
the class BigQueryDatasetRuntimeTestIT method cleanDatasetAndTable.
@AfterClass
public static void cleanDatasetAndTable() {
BigQuery bigquery = BigQueryConnection.createClient(createDatastore());
for (String dataset : datasets) {
DatasetId datasetId = DatasetId.of(BigQueryTestConstants.PROJECT, dataset);
bigquery.delete(datasetId, BigQuery.DatasetDeleteOption.deleteContents());
}
}
use of com.google.cloud.bigquery.DatasetId in project components by Talend.
the class BigQueryDatasetRuntimeTestIT method initDatasetAndTable.
@BeforeClass
public static void initDatasetAndTable() throws IOException {
BigQuery bigquery = BigQueryConnection.createClient(createDatastore());
for (String dataset : datasets) {
DatasetId datasetId = DatasetId.of(BigQueryTestConstants.PROJECT, dataset);
bigquery.create(DatasetInfo.of(datasetId));
}
for (String table : tables) {
TableDefinition tableDefinition = StandardTableDefinition.of(Schema.of(Field.of("test", Field.Type.string())));
TableId tableId = TableId.of(BigQueryTestConstants.PROJECT, datasets.get(0), table);
bigquery.create(TableInfo.of(tableId, tableDefinition));
}
}
use of com.google.cloud.bigquery.DatasetId in project components by Talend.
the class BigQueryDatasetRuntime method listTables.
@Override
public Set<String> listTables() throws IOException {
BigQuery bigquery = BigQueryConnection.createClient(properties.getDatastoreProperties());
DatasetId datasetId = DatasetId.of(properties.getDatastoreProperties().projectName.getValue(), properties.bqDataset.getValue());
Page<Table> tables = bigquery.listTables(datasetId, BigQuery.TableListOption.pageSize(100));
Set<String> tablesName = new HashSet<>();
Iterator<Table> tableIterator = tables.iterateAll();
while (tableIterator.hasNext()) {
tablesName.add(tableIterator.next().getTableId().getTable());
}
return tablesName;
}
Aggregations