列出特征组

您可以检索 Google Cloud 项目中为特定位置创建的所有特征组列表,以及与每个特征组关联的 BigQuery 源表或视图的 URI。

准备工作

向 Vertex AI 进行身份验证,除非您已完成此操作。

Select the tab for how you plan to use the samples on this page:

Console

When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

REST

如需在本地开发环境中使用本页面上的 REST API 示例,请使用您提供给 gcloud CLI 的凭据。

    Install the Google Cloud CLI, then initialize it by running the following command:

    gcloud init

如需了解详情,请参阅 Google Cloud 身份验证文档中的使用 REST 时进行身份验证

列出特征组

使用以下示例可检索项目中特定位置的所有特征组的列表。

控制台

请按照以下说明,使用 Google Cloud 控制台查看特定位置的特征组列表。

  1. 在 Google Cloud 控制台的“Vertex AI”部分,转到 Feature Store 页面。

    转到 Feature Store 页面

  2. 特征组部分中,您可以查看所选位置的所有特征组的列表。

REST

要检索项目中特定位置的所有 FeatureGroup 资源列表,请使用 featureGroups.list 方法发送 GET 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:您要查看其特征组列表的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。

HTTP 方法和网址:

GET https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups

如需发送请求,请选择以下方式之一:

curl

执行以下命令:

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

PowerShell

执行以下命令:

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

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

您应该收到类似以下内容的 JSON 响应:

{
  "featureGroups": [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME_1",
      "createTime": "2023-09-07T00:57:00.142639Z",
      "updateTime": "2023-09-07T00:57:00.142639Z",
      "etag": "AMEw9yOY0byP8qKsDY0DoZyouAtX23zDru2l422C0affZZPYNFOGgIrONELNrM49uH4=",
      "bigQuery": {
        "bigQuerySource": {
          "inputUri": "BIGQUERY_URI_1"
        }
      }
    },
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME_2",
      "createTime": "2023-09-06T23:14:30.795502Z",
      "updateTime": "2023-09-06T23:14:30.795502Z",
      "etag": "AMEw9yO5UfrPWobGR2Ry-PnbJUQoklW5lX0uW4JmKqj6OgQui6p-rMdUHfuENpQjbJ3t",
      "bigQuery": {
        "bigQuerySource": {
          "inputUri": "BIGQUERY_URI_2"
        }
      }
    }
  ]
}

后续步骤