如果特徵檢視區塊已設定為使用排定的資料同步作業,您可以選擇手動啟動資料同步作業,略過等待下一次排定同步作業的時間。
如果特徵檢視區塊設定為使用持續資料同步,您就無法手動觸發資料同步。如要進一步瞭解 Vertex AI 特徵儲存庫支援的資料同步類型,以及如何設定特徵檢視區塊的同步類型,請參閱「在特徵檢視區塊中同步特徵資料」。
請注意,如要同步整個網路商店的資料,必須同步所有特徵檢視區塊的資料。
資料同步處理可能會產生 BigQuery 資源使用費。如要瞭解如何在設定特徵檢視區塊的同步時間表時,盡量降低成本,請參閱「在同步期間盡量降低成本」。
事前準備
向 Vertex AI 進行驗證 (如果尚未完成)。
如要在本機開發環境中使用本頁的 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」。
手動啟動資料同步
使用下列範例,在已設定排定資料同步的特徵檢視中,手動啟動資料同步。
請注意,在任何時間點,功能檢視畫面只能有一項資料同步作業正在進行。如果嘗試在其他同步作業進行中手動啟動資料同步,新的同步作業只會在進行中的同步作業結束後啟動。
REST
如要在 FeatureView
中手動啟動資料同步作業,請使用 featureViews.sync 方法傳送 POST
要求。
使用任何要求資料之前,請先替換以下項目:
- LOCATION_ID:線上商店所在的區域,例如
us-central1
。 - PROJECT_ID:您的專案 ID。
- FEATUREONLINESTORE_NAME:包含特徵檢視區塊的網路商店名稱。
- FEATUREVIEW_NAME:要手動啟動資料同步的特徵檢視區塊名稱。
HTTP 方法和網址:
POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:sync
如要傳送要求,請選擇以下其中一個選項:
curl
執行下列指令:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:sync"
PowerShell
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:sync" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
{ "featureViewSync": "projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs/OPERATION_ID" }
後續步驟
瞭解如何更新特徵檢視畫面