in shared/bigqueryUtil.js [758:790]
async getTablesByLabel(datasetId, labelKey) {
let list = [];
if (datasetId) {
const dataset = this.bigqueryClient.dataset(datasetId);
const [tables] = await dataset.getTables();
if (labelKey) {
for (const table of tables) {
const labels = await this.getTableLabels(datasetId, table.id);
if (underscore.has(labels, labelKey)) {
list.push({ datasetId: table.dataset.id, tableId: table.id, type: table.metadata.type });
}
}
}
else {
tables.forEach(table => {
list.push({ datasetId: table.dataset.id, tableId: table.id, type: table.metadata.type });
});
}
}
else {
const [datasets] = await this.bigqueryClient.getDatasets();
for (const dataset of datasets) {
const [tables] = await dataset.getTables();
for (const table of tables) {
const labels = await this.getTableLabels(dataset.id, table.id);
if (underscore.has(labels, labelKey)) {
list.push({ datasetId: table.dataset.id, tableId: table.id, type: table.metadata.type });
}
}
}
}
return list;
}