0

List Datasets

by
Published today

List the datasets in a BigQuery project.

Script bigquery Verified

The script

Submitted by hugo989 Bun
Verified 4 hours ago
1
import { BigQuery } from "@google-cloud/bigquery"
2

3
/**
4
 * List Datasets
5
 * List the datasets in the service account's BigQuery project, with their location and labels.
6
 */
7
export async function main(auth: RT.Bigquery) {
8
  const bigquery = new BigQuery({
9
    credentials: auth,
10
    projectId: auth.project_id,
11
  })
12
  const [datasets] = await bigquery.getDatasets()
13
  return datasets.map((d) => d.metadata)
14
}
15