您可以从特征组中删除特定特征。删除特征会从 Feature Registry 中取消注册特征列,但不会影响已注册 BigQuery 源表或视图中的列中的数据。您可以根据需要在任何特征组中创建另一个特征,以再次注册同一列。
准备工作
向 Vertex AI 进行身份验证,除非您已完成此操作。
如需在本地开发环境中使用本页面上的 REST API 示例,请使用您提供给 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.
如需了解详情,请参阅 Google Cloud 身份验证文档中的使用 REST 时进行身份验证。
删除特征
使用以下示例可从特征组中删除特征。
REST
如需删除 Feature
资源,请使用 features.delete 方法发送 DELETE
请求。
在使用任何请求数据之前,请先进行以下替换:
- LOCATION_ID:特征组所在的区域,例如
us-central1
。 - PROJECT_ID:您的项目 ID。
- FEATURE_GROUP_NAME:包含特征的特征组的名称。
- FEATURE_NAME:要删除的特征的名称。
HTTP 方法和网址:
DELETE https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features/FEATURE_NAME
如需发送请求,请选择以下方式之一:
curl
执行以下命令:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features/FEATURE_NAME"
PowerShell
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features/FEATURE_NAME" | Select-Object -Expand Content
您应该收到类似以下内容的 JSON 响应:
"name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteOperationMetadata", "genericMetadata": { "createTime": "2023-09-25T18:52:42.092928Z", "updateTime": "2023-09-25T18:52:42.092928Z" } }, "done": true, "response": { "@type": "type.googleapis.com/google.protobuf.Empty" } }