Class Model (8.0.0)

Model objects are returned by methods such as and .

Package

@google-cloud/bigquery

Example

const{BigQuery}=require('@google-cloud/bigquery');constbigquery=newBigQuery();constdataset=bigquery.dataset('my-dataset');constmodel=dataset.model('my-model');

Constructors

(constructor)(dataset, id)

constructor(dataset:Dataset,id:string);

Constructs a new instance of theModel class

Parameters
NameDescription
datasetDataset
idstring

Properties

bigQuery

bigQuery:BigQuery;

dataset

dataset:Dataset;

Methods

createExtractJob(destination, options)

createExtractJob(destination:string|File,options?:CreateExtractJobOptions):Promise<JobResponse>;

Export model to Cloud Storage.

SeeJobs: insert API Documentation

Parameters
NameDescription
destinationstring |File

Where the model should be exported to. A string or object.

optionsCreateExtractJobOptions

The configuration object. For all extract job options, see [CreateExtractJobOptions]https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationExtract.

Returns
TypeDescription
Promise<JobResponse>

{Promise

Example
const{BigQuery}=require('@google-cloud/bigquery');constbigquery=newBigQuery();constdataset=bigquery.dataset('my-dataset');constmodel=dataset.model('my-model');constextractedModel='gs://my-bucket/extracted-model';functioncallback(err,job,apiResponse){// `job` is a Job object that can be used to check the status of the// request.}//-// To use the default options, just pass a string or a {@linkhttps://googleapis.dev/nodejs/storage/latest/File.html File}object.//// Note: The default format is 'ML_TF_SAVED_MODEL'.//-model.createExtractJob(extractedModel,callback);//-// If you need more customization, pass an `options` object.//-constoptions={format:'ML_TF_SAVED_MODEL',jobId:'123abc'};model.createExtractJob(extractedModel,options,callback);//-// If the callback is omitted, we'll return a Promise.//-model.createExtractJob(extractedModel,options).then((data)=>{constjob=data[0];constapiResponse=data[1];});

createExtractJob(destination, options, callback)

createExtractJob(destination:string|File,options:CreateExtractJobOptions,callback:JobCallback):void;
Parameters
NameDescription
destinationstring |File
optionsCreateExtractJobOptions
callbackJobCallback
Returns
TypeDescription
void

createExtractJob(destination, callback)

createExtractJob(destination:string|File,callback:JobCallback):void;
Parameters
NameDescription
destinationstring |File
callbackJobCallback
Returns
TypeDescription
void

extract(destination, options)

extract(destination:string|File,options?:CreateExtractJobOptions):Promise<JobMetadataResponse>;

Export model to Cloud Storage.

Parameters
NameDescription
destinationstring |File

Where the model should be exported to. A string or object.

optionsCreateExtractJobOptions

The configuration object. For all extract job options, see [CreateExtractJobOptions]https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationExtract.

Returns
TypeDescription
Promise<JobMetadataResponse>

{Promise

Example
const{BigQuery}=require('@google-cloud/bigquery');constbigquery=newBigQuery();constdataset=bigquery.dataset('my-dataset');constmodel=dataset.model('my-model');constextractedModel='gs://my-bucket/extracted-model';//-functioncallback(err,job,apiResponse){// `job` is a Job object that can be used to check the status of the// request.}//-// To use the default options, just pass a string or a {@linkhttps://googleapis.dev/nodejs/storage/latest/File.html File}object.//// Note: The default format is 'ML_TF_SAVED_MODEL'.//-model.createExtractJob(extractedModel,callback);//-// If you need more customization, pass an `options` object.//-constoptions={format:'ML_TF_SAVED_MODEL',jobId:'123abc'};model.createExtractJob(extractedModel,options,callback);//-// If the callback is omitted, we'll return a Promise.//-model.createExtractJob(extractedModel,options).then((data)=>{constjob=data[0];constapiResponse=data[1];});

extract(destination, options, callback)

extract(destination:string|File,options:CreateExtractJobOptions,callback?:JobMetadataCallback):void;
Parameters
NameDescription
destinationstring |File
optionsCreateExtractJobOptions
callbackJobMetadataCallback
Returns
TypeDescription
void

extract(destination, callback)

extract(destination:string|File,callback?:JobMetadataCallback):void;
Parameters
NameDescription
destinationstring |File
callbackJobMetadataCallback
Returns
TypeDescription
void

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.