use of bio.terra.service.snapshot.SnapshotTable in project jade-data-repo by DataBiosphere.
the class BigQueryPdao method getSnapshotTableRowCounts.
public Map<String, Long> getSnapshotTableRowCounts(Snapshot snapshot) throws InterruptedException {
BigQueryProject bigQueryProject = bigQueryProjectForSnapshot(snapshot);
Map<String, Long> rowCounts = new HashMap<>();
for (SnapshotTable snapshotTable : snapshot.getTables()) {
String tableName = snapshotTable.getName();
String sql = new ST(rowCountTemplate).add("rowId", PDAO_ROW_ID_COLUMN).add("project", bigQueryProject.getProjectId()).add("dataset", snapshot.getName()).add("table", tableName).render();
TableResult result = bigQueryProject.query(sql);
rowCounts.put(tableName, getSingleLongValue(result));
}
return rowCounts;
}
Aggregations