Stay organized with collections Save and categorize content based on your preferences.
This page shows you how to update BigQuery ML model metadata. You can update model metadata by:
bq update
command in the bq command-line tool.models.patch
API method directly or by using the client libraries.The following model metadata can be updated:
To update model metadata, you must be assigned the WRITER
role on the dataset, or you must be assigned a project-level Identity and Access Management (IAM) role that includes bigquery.models.updateMetadata
permissions. If you are granted bigquery.models.updateMetadata
permissions at the project level, you can update metadata for models in any dataset in the project. The following predefined, project-level IAM roles include bigquery.models.updateMetadata
permissions:
bigquery.dataEditor
bigquery.dataOwner
bigquery.admin
For more information on IAM roles and permissions in BigQuery ML, see Access control.
Update a model's descriptionA model's description is a text string that is used to identify the model.
To update a model's description:
ConsoleIn the Google Cloud console, go to the BigQuery page.
In the Explorer pane, expand your project and then expand a dataset.
Expand the Models folder in the dataset, and then click a model name to select the model.
Click the Details tab.
To update the model's description, click Edit edit.
In the Edit detail dialog, update the description and then click Save.
To update a model's description, issue the bq update
command with the --model
or -m
flag and the --description
flag.
If you are updating a model in a project other than your default project, add the project ID to the dataset in the following format: [PROJECT_ID]:[DATASET]
.
bq update --model --description "[STRING]" PROJECT_ID:DATASET.MODEL
Replace the following:
STRING
is the text string that describes your model in quotes.PROJECT_ID
is your project ID.DATASET
is the name of the dataset.MODEL
is the name of the model.The command output looks like the following:
Model 'myproject.mydataset.mymodel' successfully updated.
You can confirm your changes by issuing the bq show
command. For more information, see Get model metadata.
Examples:
Enter the following command to update the description of mymodel
in mydataset
in your default project.
bq update --model --description "My updated description" \
mydataset.mymodel
Enter the following command to update the description of mymodel
in mydataset
in myotherproject
.
bq update --model --description "My updated description" \
myotherproject:mydataset.mymodel
API
To update a model's description by using the API, call the models.patch
method and provide the projectId
, datasetId
, and modelId
. To modify the description, add to or update the "description" property for the model resource.
Before trying this sample, follow the Go setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery Go API reference documentation.
To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
JavaBefore trying this sample, follow the Java setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery Java API reference documentation.
To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
Node.jsBefore 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.
To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
PythonBefore trying this sample, follow the Python setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery Python API reference documentation.
To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
Update a model's labelsLabels are key-value pairs that you can attach to a resource. When you create BigQuery ML resources, labels are optional. For more information, see Adding and using labels.
To update a model's labels:
ConsoleIn the Explorer pane, expand your project and then expand a dataset.
Expand the Models folder in the dataset, and then click a model name to select the model.
Click the Details tab.
To update the model's labels, click Edit edit.
In the Edit detail dialog, add, delete, or modify labels, and then click Save.
To update a model's labels, issue the bq update
command with the --model
or -m
flag and the --set_label
flag. Repeat the --set_label
flag to add or update multiple labels.
If you are updating a model in a project other than your default project, add the project ID to the dataset in the following format: [PROJECT_ID]:[DATASET]
.
bq update --model --set_label KEY:VALUE \ PROJECT_ID:DATASET.MODEL
Replace the following:
KEY:VALUE
corresponds to a key:value pair for a label that you want to add or update. If you specify the same key as an existing label, the value for the existing label is updated. The key must be unique.PROJECT_ID
is your project ID.DATASET
is the name of the dataset.MODEL
is the name of the model.The command output looks like the following.
Model 'myproject.mydataset.mymodel' successfully updated.
You can confirm your changes by issuing the bq show
command. For more information, see Get model metadata.
Examples:
To update the department
label on mymodel
, enter the bq update
command and specify department
as the label key. For example, to update the department:shipping
label to department:logistics
, enter the following command. mydataset
is in myotherproject
, not your default project.
bq update --model --set_label department:logistics \
myotherproject:mydataset.mymodel
API
To update a model's labels by using the API, call the models.patch
method and provide the projectId
, datasetId
, and modelId
. To modify the labels, add to or update the "labels" property for the model resource.
A model's expiration time is a timestamp value that dictates when a model is deleted. You can set a model's expiration time when the model is created by using the CLI, the API, or the client libraries. You can also set or update the expiration time on a model after it is created. A model's expiration time is often referred to as "time to live" or TTL.
If you don't set an expiration time on a model, the model never expires and you must delete the model manually.
Note: Setting or updating the expiration time on a model is not supported by the Google Cloud console.The value for the expiration time is expressed differently depending on where the value is set. Use the method that gives you the appropriate level of granularity:
To update the expiration time for a model:
ConsoleSetting or updating the expiration time on a model is not supported by the Google Cloud console.
bqTo update a model's expiration time, issue the bq update
command with the --model
or -m
flag and the --expiration
flag.
If you are updating a model in a project other than your default project, add the project ID to the dataset in the following format: [PROJECT_ID]:[DATASET]
.
bq update --model --expiration INTEGER \ PROJECT_ID:DATASET.MODEL
Replace the following:
INTEGER
is the lifetime (in seconds) for the model. The minimum value is 3600 seconds (one hour). The expiration time evaluates to the current UTC time plus the integer value.PROJECT_ID
is your project ID.DATASET
is the name of the dataset.MODEL
is the name of the model.The command output looks like the following.
Model 'myproject.mydataset.mymodel' successfully updated.
You can confirm your changes by issuing the bq show
command. For more information, see Get model metadata.
Examples:
Enter the following command to update the expiration time of mymodel
in mydataset
to 5 days (432000 seconds). mydataset
is in your default project.
bq update --model --expiration 432000 mydataset.mymodel
Enter the following command to update the expiration time of mymodel
in mydataset
to 5 days (432000 seconds). mydataset
is in myotherproject
, not your default project.
bq update --model --expiration 432000 myotherproject:mydataset.mymodel
API
To update a model's expiration by using the API, call the models.patch
method and provide the projectId
, datasetId
, and modelId
. To modify the expiration, add to or update the "expirationTime" property for the model resource. "expirationTime" is expressed in milliseconds since the epoch.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["You can update BigQuery ML model metadata, including the description, labels, and expiration time, using the Google Cloud console, the `bq update` command, or the `models.patch` API method."],["Updating a model's description involves modifying a text string that serves to identify the model, and this can be achieved via the console, `bq update` command, API calls or client libraries."],["Model labels, which are key-value pairs, can be added, deleted, or modified through the console, the `bq update` command, or by calling the `models.patch` API method."],["The expiration time of a model can be updated using the `bq update` command or the `models.patch` API, but it cannot be updated via the console, and the expiration time determines when a model is automatically deleted."],["To update any of the model metadata, the user must be assigned the `WRITER` role on the dataset, or a project-level Identity and Access Management (IAM) role that includes `bigquery.models.updateMetadata` permissions."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4