Constructor
new Model(dataset, id)
Parameters:
Name | Type | Description |
---|---|---|
dataset |
Dataset |
Dataset instance. |
id |
string |
The ID of the model. |
Methods
delete(callbackopt) → {Promise}
Delete the model.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
- See:
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();
exists(callbackopt) → {Promise}
Check if the model exists.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
<optional> |
The callback function. Properties
|
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}
Get a model if it exists.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
- See:
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}
Return the metadata associated with the model.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
- See:
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}
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metadata |
object |
The metadata key/value object to set. |
|||||||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
- See:
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);