Delete feature values

You can delete feature values from an entity type in the following ways:

Delete feature values from specified entities

You can delete feature values from multiple entities within an entity type. To specify the entities from which you want to delete the feature values, you need to list the entity IDs in a CSV file.

REST

To delete feature values, send a POST request using the featurestores.entityTypes.deleteFeatureValues method.

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

  • LOCATION_ID: Region or location where the featurestore is created. For example, us-central1.
  • PROJECT_ID: Your project ID.
  • FEATURESTORE_ID: ID of the featurestore.
  • ENTITY_TYPE: ID of the entity type from which you want to delete the feature values.
  • CSV_FILE_URI: Specify the Cloud Storage URI of the CSV file containing the entity IDs for which you want to delete feature values. The first line of this file should be one of the following:
    • If you specify the entity_id_field parameter, then the first line of the CSV file must be the same as ENTITY_ID_FIELD.
    • If you don't specify the entity_id_field parameter, then the first line of the CSV file must be "entity_id".
  • ENTITY_ID_FIELD: (Optional) Enter the string specified in the first line of the CSV file at CSV_FILE_URI.

HTTP method and URL:

POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues

Request JSON body:

{
  "selectEntity": {
    "entityIdSelector": {
      "csv_source": {
        "gcs_source": {
          "uris": [
            "CSV_FILE_URI"
          ]
        },
        "entity_id_field": "ENTITY_ID_FIELD"
      }
    }
  }
}

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 POST \
-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/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues"

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 POST `
-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/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/571445526053/locations/us-central1/operations/7688824614775947264",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteFeatureValuesOperationMetadata",
    "genericMetadata": {
      "createTime": "2022-05-09T16:59:38.128375Z",
      "updateTime": "2022-05-09T16:59:38.128375Z",
      "state": "RUNNING",
      "worksOn": [
        "projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID"
      ]
    }
  }
}

View request status

To check the status of the POST request, send the following GET request.

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

  • LOCATION_ID: Region or location where the featurestore is created. For example, us-central1.
  • OPERATION_NAME: The value of the `name` field in the JSON response received from the POST request to delete feature values.

HTTP method and URL:

GET https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME"

PowerShell

Execute the following command:

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

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME" | Select-Object -Expand Content

You should receive a successful status code (2xx) and an empty response.

Delete feature values from specified features within a time range

You can delete feature values from an entity type by specifying the feature IDs and a time range.

REST

To delete feature values from an entity type, send a POST request using the featurestores.entityTypes.deleteFeatureValues method.

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

  • LOCATION_ID: Region or location where the featurestore is created. For example, us-central1.
  • PROJECT_ID: Your project ID.
  • FEATURESTORE_ID: ID of the featurestore.
  • ENTITY_TYPE: ID of the entity type from which you want to delete the feature values.
  • START_TIME: Specify the start time of the time range.
  • END_TIME: (Optional) Specify the end time of the time range.
  • SKIP_ONLINE_STORAGE_DELETE: (Optional) To delete feature values from the online storage as well as the offline storage, enter false. Otherwise, to delete feature values from the offline storage only, enter true.

HTTP method and URL:

POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues

Request JSON body:

{
  "selectTimeRangeAndFeature": {
    "timeRange": {
      "startTime": "START_TIME",
      "endTime": "END_TIME"
    },
    "featureSelector": {
      "idMatcher": {
        "ids": [ "FEATURE_ID", ...]
      }
    },
    "skipOnlineStorageDelete": SKIP_ONLINE_STORAGE_DELETE
  }
}

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 POST \
-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/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues"

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 POST `
-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/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE:deleteFeatureValues" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/571445526053/locations/us-central1/operations/7688824614775947264",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteFeatureValuesOperationMetadata",
    "genericMetadata": {
      "createTime": "2022-05-09T16:59:38.128375Z",
      "updateTime": "2022-05-09T16:59:38.128375Z",
      "state": "RUNNING",
      "worksOn": [
        "projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID"
      ]
    }
  }
}

View request status

To check the status of the POST request, send the following GET request.

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

  • LOCATION_ID: Region or location where the featurestore is created. For example, us-central1.
  • OPERATION_NAME: The value of the `name` field in the JSON response received from the POST request to delete feature values.

HTTP method and URL:

GET https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME"

PowerShell

Execute the following command:

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

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/OPERATION_NAME" | Select-Object -Expand Content

You should receive a successful status code (2xx) and an empty response.

What's next

View the Vertex AI Feature Store quotas and limits.