// Import the Google Cloud client library
const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
async function listModels() {
// Lists all existing models in the dataset using streaming method.
/**
* TODO(developer): Uncomment the following lines before running the sample.
*/
// const datasetId = "my_dataset";
const dataset = bigquery.dataset(datasetId);
dataset
.getModelsStream()
.on('error', console.error)
.on('data', model => {
console.log(model.metadata);
})
.on('end', () => {
console.log('All models have been retrieved.');
});
}