Skip to content

Commit

Permalink
Append current timestamp into dataset name
Browse files Browse the repository at this point in the history
  • Loading branch information
Boyuan Zhang committed Aug 24, 2018
1 parent 7a75876 commit 92a055c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public class BigQueryToTableIT {

private BigQueryToTableOptions options;
private String project;
private final String BIG_QUERY_DATASET_ID = "java_query_to_table_it";
private final String timestamp = Long.toString(System.currentTimeMillis());
private final String BIG_QUERY_DATASET_ID = "bq_query_to_table_" + timestamp;
private final String OUTPUT_TABLE_NAME = "output_table";
private BigQueryOptions bqOption;
private String outputTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void createNewDataset(String projectId, String datasetId) {
projectId,
new Dataset().setDatasetReference(new DatasetReference().setDatasetId(datasetId)))
.execute();
LOG.info("Successfully created new dataset : " + datasetId);
} catch (Exception e) {
LOG.debug("Exceptions catched when creating new dataset: " + e.getMessage());
}
Expand All @@ -138,6 +139,7 @@ public void createNewDataset(String projectId, String datasetId) {
public void deleteTable(String projectId, String datasetId, String tableName) {
try {
bqClient.tables().delete(projectId, datasetId, tableName).execute();
LOG.info("Successfully deleted table: " + tableName);
} catch (Exception e) {
LOG.debug("Exception catched when deleting table: " + e.getMessage());
}
Expand All @@ -155,6 +157,7 @@ public void deleteDataset(String projectId, String datasetId) {

try {
bqClient.datasets().delete(projectId, datasetId).execute();
LOG.info("Successfully deleted dataset: " + datasetId);
} catch (Exception e) {
LOG.debug("Exceptions catched when deleting dataset: " + e.getMessage());
}
Expand Down

0 comments on commit 92a055c

Please sign in to comment.