Model objects are returned by methods such as and .
Package
@google-cloud/bigqueryExample
const
{
BigQuery
}
=
require
(
' @google-cloud/bigquery
'
);
const
bigquery
=
new
BigQuery
();
const
dataset
=
bigquery
.
dataset
(
'my-dataset'
);
const
model
=
dataset
.
model
(
'my-model'
);
Constructors
(constructor)(dataset, id)
constructor
(
dataset
:
Dataset
,
id
:
string
);
Constructs a new instance of the Model
class
dataset
Dataset
id
string
Properties
bigQuery
bigQuery
:
BigQuery
;
dataset
dataset
:
Dataset
;
Methods
createExtractJob(destination, options)
createExtractJob
(
destination
:
string
|
File
,
options
?:
CreateExtractJobOptions
)
:
Promise<JobResponse>
;
Export model to Cloud Storage.
destination
options
CreateExtractJobOptions
The configuration object. For all extract job options, see [CreateExtractJobOptions] https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationExtract .
const
{
BigQuery
}
=
require
(
' @google-cloud/bigquery
'
);
const
bigquery
=
new
BigQuery
();
const
dataset
=
bigquery
.
dataset
(
'my-dataset'
);
const
model
=
dataset
.
model
(
'my-model'
);
const
extractedModel
=
'gs://my-bucket/extracted-model'
;
function
callback
(
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 {@link
https
:
//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.
//-
const
options
=
{
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
)
=
>
{
const
job
=
data
[
0
];
const
apiResponse
=
data
[
1
];
});
createExtractJob(destination, options, callback)
createExtractJob
(
destination
:
string
|
File
,
options
:
CreateExtractJobOptions
,
callback
:
JobCallback
)
:
void
;
void
createExtractJob(destination, callback)
createExtractJob
(
destination
:
string
|
File
,
callback
:
JobCallback
)
:
void
;
void
extract(destination, options)
extract
(
destination
:
string
|
File
,
options
?:
CreateExtractJobOptions
)
:
Promise<JobMetadataResponse>
;
Export model to Cloud Storage.
destination
options
CreateExtractJobOptions
The configuration object. For all extract job options, see [CreateExtractJobOptions] https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationExtract .
const
{
BigQuery
}
=
require
(
' @google-cloud/bigquery
'
);
const
bigquery
=
new
BigQuery
();
const
dataset
=
bigquery
.
dataset
(
'my-dataset'
);
const
model
=
dataset
.
model
(
'my-model'
);
const
extractedModel
=
'gs://my-bucket/extracted-model'
;
//-
function
callback
(
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 {@link
https
:
//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.
//-
const
options
=
{
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
)
=
>
{
const
job
=
data
[
0
];
const
apiResponse
=
data
[
1
];
});
extract(destination, options, callback)
extract
(
destination
:
string
|
File
,
options
:
CreateExtractJobOptions
,
callback
?:
JobMetadataCallback
)
:
void
;
void
extract(destination, callback)
extract
(
destination
:
string
|
File
,
callback
?:
JobMetadataCallback
)
:
void
;
void