Edits history of script submission #23016 for ' List Datasets (bigquery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { BigQuery } from "@google-cloud/bigquery"
    
    /**
     * List Datasets
     * List the datasets in the service account's BigQuery project, with their location and labels.
     */
    export async function main(auth: RT.Bigquery) {
      const bigquery = new BigQuery({
        credentials: auth,
        projectId: auth.project_id,
      })
      const [datasets] = await bigquery.getDatasets()
      return datasets.map((d) => d.metadata)
    }
    

    Submitted by hugo989 4 hours ago