Update a feature view

You can update a feature view to modify the list of feature data sources associated with it. For example, you might want to make the following updates:

  • Associate a different feature group and features, or a different set of features from the same feature group.

  • Specify a different BigQuery table or view containing the feature data. Note that in this case, you also need to specify one or more entity ID columns from the updated data source.

  • Specify a different set of entity ID columns from the same BigQuery data source.

While creating or updating a feature view, you have the option to add user-defined metadata in the form of labels to the feature view. For more information about how to update user-defined labels for a feature view, see Update labels for a feature view .

Note that you can't update a feature view that's configured for continuous data sync .

Before you begin

Authenticate to Vertex AI, unless you've done so already.

To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

    Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:

    gcloud  
    init

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

For more information, see Authenticate for using REST in the Google Cloud authentication documentation.

Update a feature view based on feature group

Use the following sample to update a feature view by specifying features from an existing feature group.

REST

To update a FeatureView resource, send a PATCH request by using the featureViews.patch method.

Before using any of the request data, make the following replacements:

  • LOCATION_ID : Region where the online store is located, such as us-central1 .
  • PROJECT_ID : Your project ID.
  • FEATUREONLINESTORE_NAME : The name of the online store containing the feature view.
  • FEATUREVIEW_NAME : The name of the feature view you want to update.
  • FEATUREGROUP_NAME : The name of the feature group you want to associate with the feature view.
  • FEATURE_ID_1 and FEATURE_ID_2 : Feature IDs that you want to add to the feature view from the FEATUREGROUP_NAME feature group.

HTTP method and URL:

PATCH https:// LOCATION_ID 
-aiplatform.googleapis.com/v1/projects/ PROJECT_ID 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 

Request JSON body:

{
  "feature_registry_source":
    { "feature_groups": [
      {
        "feature_group_id": " FEATUREGROUP_NAME 
",
        "feature_ids": [ " FEATURE_ID_1 
", " FEATURE_ID_2 
" ]
      }
    ]
  }
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json , and execute the following command:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https:// LOCATION_ID -aiplatform.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION_ID /featureOnlineStores/ FEATUREONLINESTORE_NAME /featureViews/ FEATUREVIEW_NAME "

PowerShell

Save the request body in a file named request.json , and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https:// LOCATION_ID -aiplatform.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION_ID /featureOnlineStores/ FEATUREONLINESTORE_NAME /featureViews/ FEATUREVIEW_NAME " | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 
/operations/ OPERATION_ID 
",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.UpdateFeatureViewOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-15T04:53:22.794004Z",
      "updateTime": "2023-09-15T04:53:22.794004Z"
    }
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.FeatureView",
    "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 
"
  }
}

Update a feature view based on a BigQuery source

Use the following sample to update a feature view by specifying feature columns from a BigQuery table or view.

REST

To update a FeatureView instance based on a BigQuery data source, send a PATCH request by using the featureViews.patch method.

Before using any of the request data, make the following replacements:

  • LOCATION_ID : Region where the online store is located, such as us-central1 .
  • PROJECT_ID : Your project ID.
  • FEATUREONLINESTORE_NAME : The name of the online store containing the feature view.
  • FEATUREVIEW_NAME : The name of the feature view you want to update.
  • BIGQUERY_SOURCE_URI : URI of the BigQuery table or view containing the feature data.
  • ENTITY_ID_COLUMNS :
  • ENTITY_ID_COLUMNS : The names of the column(s) containing the entity IDs. You can specify either one column or multiple columns.
    • To specify only one entity ID column, specify the column name in the following format:
      "entity_id_column_name" .
    • To specify multiple entity ID columns, specify the column names in the following format:
      ["entity_id_column_1_name", "entity_id_column_2_name", ...] .

HTTP method and URL:

PATCH https:// LOCATION_ID 
-aiplatform.googleapis.com/v1/projects/ PROJECT_ID 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 

Request JSON body:

{
  "big_query_source":
  {
    "uri": " BIGQUERY_SOURCE_URI 
",
    "entity_id_columns": " ENTITY_ID_COLUMNS 
"
  }
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json , and execute the following command:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https:// LOCATION_ID -aiplatform.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION_ID /featureOnlineStores/ FEATUREONLINESTORE_NAME /featureViews/ FEATUREVIEW_NAME "

PowerShell

Save the request body in a file named request.json , and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https:// LOCATION_ID -aiplatform.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION_ID /featureOnlineStores/ FEATUREONLINESTORE_NAME /featureViews/ FEATUREVIEW_NAME " | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 
/operations/ OPERATION_ID 
",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.UpdateFeatureViewOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-15T04:53:34.832192Z",
      "updateTime": "2023-09-15T04:53:34.832192Z"
    }
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.FeatureView",
    "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION_ID 
/featureOnlineStores/ FEATUREONLINESTORE_NAME 
/featureViews/ FEATUREVIEW_NAME 
"
  }
}

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: