列出特徵群組

您可以擷取 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 的憑證。

    After installing the Google Cloud CLI, initialize it 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 驗證說明文件中的「Authenticate for using 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 回應:BIGQUERY_URI_1 是透過 FEATURE_GROUP_NAME_1 註冊的 BigQuery 來源資料表或檢視區塊,而 BIGQUERY_URI_2 是透過 FEATURE_GROUP_NAME_2 註冊的 BigQuery 來源資料表或檢視區塊。
如果回應中列出的任何功能群組有專屬的服務帳戶設定,詳細資料中也會列出服務帳戶電子郵件地址。在本範例中,SERVICE_ACCOUNT_EMAIL 是與特徵群組 FEATURE_GROUP_NAME_1 相關聯的服務帳戶電子郵件地址。
{
  "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"
        }
      }
      "serviceAccountEmail": "SERVICE_ACCOUNT_EMAIL"
    },
    {
      "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"
        }
      }
    }
  ]
}

後續步驟