in services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/services/scan/AutoDlpResultsScannerImpl.java [97:125]
public List<String> listChildren(String project, String dataset) throws InterruptedException, NonRetryableApplicationException {
String queryTemplate = "SELECT DISTINCT CONCAT(column_profile.dataset_project_id, '.', column_profile.dataset_id, '.', column_profile.table_id) AS table FROM %s.%s.%s WHERE column_profile.dataset_project_id = '%s' AND column_profile.dataset_id = '%s'";
String formattedQuery = String.format(queryTemplate,
hostProject,
hostDataset,
dlpLatestFindingsView,
project,
dataset
);
// Create a job ID so that we can safely retry.
Job queryJob = bqService.submitJob(formattedQuery);
TableResult result = bqService.waitAndGetJobResults(queryJob);
List<String> datasetTables = new ArrayList<>();
for (FieldValueList row : result.iterateAll()) {
if (row.get("table").isNull()) {
throw new NonRetryableApplicationException("processDatasets query returned rows with null 'table' field.");
}
String tableSpec = row.get("table").getStringValue();
datasetTables.add(tableSpec);
}
return datasetTables;
}