Search in sources :

Example 1 with Tables

use of com.google.api.services.bigquery.model.TableList.Tables in project beam by apache.

the class BigqueryClient method deleteDataset.

public void deleteDataset(String projectId, String datasetId) {
    try {
        TableList tables = bqClient.tables().list(projectId, datasetId).execute();
        for (Tables table : tables.getTables()) {
            this.deleteTable(projectId, datasetId, table.getTableReference().getTableId());
        }
    } catch (Exception e) {
        LOG.debug("Exceptions caught when listing all tables: " + e.getMessage());
    }
    try {
        bqClient.datasets().delete(projectId, datasetId).execute();
        LOG.info("Successfully deleted dataset: " + datasetId);
    } catch (Exception e) {
        LOG.debug("Exceptions caught when deleting dataset: " + e.getMessage());
    }
}
Also used : Tables(com.google.api.services.bigquery.model.TableList.Tables) TableList(com.google.api.services.bigquery.model.TableList) IOException(java.io.IOException)

Aggregations

TableList (com.google.api.services.bigquery.model.TableList)1 Tables (com.google.api.services.bigquery.model.TableList.Tables)1 IOException (java.io.IOException)1