Movatterモバイル変換


[0]ホーム

URL:


Model

Model

Model objects are returned by methods such asDataset#model andDataset#getModels.

Constructor

new Model(dataset, id)

Parameters:
NameTypeDescription
datasetDataset

Dataset instance.

id string

The ID of the model.

Example
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');```

Methods

delete(callbackopt) → {Promise}

Delete the model.

SeeModels: delete API Documentation

Parameters:
NameTypeAttributesDescription
callbackDeleteModelCallback <optional>

The callback function.

Properties
NameTypeAttributesDescription
err error <nullable>

An error returned while making thisrequest.

apiResponse object

The full API response.

Returns:
TypeDescription
Promise
Examples
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');model.delete((err, apiResponse) => {});```
If the callback is omitted we'll return a Promise.```const [apiResponse] = await model.delete();```
If successful, the response body is empty.``````

exists(callbackopt) → {Promise.<ModelExistsResponse>}

Check if the model exists.

Parameters:
NameTypeAttributesDescription
callbackModelExistsCallback <optional>

The callback function.

Properties
NameTypeAttributesDescription
err error <nullable>

An error returned while making thisrequest.

exists boolean

Whether the model exists or not.

Returns:
TypeDescription
Promise.<ModelExistsResponse>
Examples
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');model.exists((err, exists) => {});```
If the callback is omitted we'll return a Promise.```const [exists] = await model.exists();```

get:(callbackopt) → {Promise.<GetModelResponse>}

Get a model if it exists.

SeeModels: get API Documentation

Parameters:
NameTypeAttributesDescription
callbackGetModelCallback <optional>

The callback function.

Properties
NameTypeAttributesDescription
err error <nullable>

An error returned while making thisrequest.

modelModel

TheModel.

apiResponse object

The full API response.

Returns:
TypeDescription
Promise.<GetModelResponse>
Examples
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');model.get(err => {  if (!err) {    // `model.metadata` has been populated.  }});```
If the callback is omitted we'll return a Promise.```await model.get();```

getMetadata(callbackopt) → {Promise.<GetModelMetadataResponse>}

Return the metadata associated with the model.

SeeModels: get API Documentation

Parameters:
NameTypeAttributesDescription
callbackGetModelMetadataCallback <optional>

The callback function.

Properties
NameTypeAttributesDescription
err error <nullable>

An error returned while making thisrequest.

metadata object

The metadata of the model.

apiResponse object

The full API response.

Returns:
TypeDescription
Promise.<GetModelMetadataResponse>
Examples
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');model.getMetadata((err, metadata, apiResponse) => {});```
If the callback is omitted we'll return a Promise.```const [metadata, apiResponse] = await model.getMetadata();```

setMetadata(metadata, callbackopt) → {Promise.<SetModelMetadataResponse>}

SeeModels: patch API Documentation

Parameters:
NameTypeAttributesDescription
metadata object

The metadata key/value object to set.

callbackSetModelMetadataCallback <optional>

The callback function.

Properties
NameTypeAttributesDescription
err error <nullable>

An error returned while making thisrequest.

metadata object

The updated metadata of the model.

apiResponse object

The full API response.

Returns:
TypeDescription
Promise.<SetModelMetadataResponse>
Examples
```const {BigQuery} = require('@google-cloud/bigquery');const bigquery = new BigQuery();const dataset = bigquery.dataset('my-dataset');const model = dataset.model('my-model');const metadata = {  friendlyName: 'TheBestModelEver'};model.setMetadata(metadata, (err, metadata, apiResponse) => {});```
If the callback is omitted we'll return a Promise.```const [metadata, apiResponse] = await model.setMetadata(metadata);```


[8]ページ先頭

©2009-2025 Movatter.jp