List models using streaming

Stay organized with collections Save and categorize content based on your preferences.

Lists all existing models in the dataset using streaming.

Code sample


Before trying this sample, follow the Node.js setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery Node.js API reference documentation.

// 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);

    .on('error', console.error)
    .on('data', model => {
    .on('end', () => {
      console.log('All models have been retrieved.');

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.