Skip to content
Permalink
Browse files
fix(samples): dataset getcreatetime (#866)
  • Loading branch information
Praful Makani committed Oct 26, 2020
1 parent d1d72ed commit 992baaf85ae2904bb5900cfdfce6b447fd301b3b
Showing with 5 additions and 5 deletions.
  1. +5 −5 samples/snippets/src/main/java/com/example/bigquery/ResourceCleanUp.java
@@ -47,13 +47,13 @@ public static void main(String[] args) {
// clean up stale test datasets
Page<Dataset> datasets = bigquery.listDatasets(PROJECT_ID, DatasetListOption.pageSize(1000));
for (Dataset dataset : datasets.getValues()) {
dataset = dataset.reload();
String datasetName = dataset.getDatasetId().getDataset();
if ((datasetName.contains("CREATE_DATASET_AWS_TEST_")
|| datasetName.contains("MY_DATASET_")
|| datasetName.contains("gcloud_test_")
|| datasetName.contains("SHARED_DATASET_TEST_"))
// && dataset.getCreationTime() > sixHourAgo
) {
|| datasetName.contains("MY_DATASET_")
|| datasetName.contains("gcloud_test_")
|| datasetName.contains("SHARED_DATASET_TEST_"))
&& dataset.getCreationTime() > sixHourAgo) {
System.out.format("\tDeleting Dataset: %s\n", datasetName);
bigquery.delete(
DatasetId.of(PROJECT_ID, datasetName), BigQuery.DatasetDeleteOption.deleteContents());

0 comments on commit 992baaf

Please sign in to comment.