From 838e72087f75be5e92dd25f9f475ca61b06ab745 Mon Sep 17 00:00:00 2001 From: Kamal Gurala Date: Fri, 10 Nov 2023 17:15:29 -0800 Subject: [PATCH] refactor: explicitly prepare featch_Feature_values request (#2485) * refactor: explicitly prepare featch_Feature_values request * Fix unintednded metadata updates * Fixes from linter * add unique to resource ids * add unique to resource ids for public optimized --------- Co-authored-by: Kamal Gurala Co-authored-by: Andrew Ferlitsch --- ...ing_bigquery_data_with_feature_store.ipynb | 10 +++-- ...ry_data_with_feature_store_optimized.ipynb | 38 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb b/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb index 02ac2dacb..8356354ba 100644 --- a/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb +++ b/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store.ipynb @@ -612,7 +612,7 @@ }, "outputs": [], "source": [ - "FEATURE_ONLINE_STORE_ID = \"the_look_demo\" # @param {type:\"string\"}\n", + "FEATURE_ONLINE_STORE_ID = \"the_look_demo_unique\" # @param {type:\"string\"}\n", "\n", "online_store_config = feature_online_store_pb2.FeatureOnlineStore(\n", " bigtable=feature_online_store_pb2.FeatureOnlineStore.Bigtable(\n", @@ -808,7 +808,7 @@ }, "outputs": [], "source": [ - "FEATURE_GROUP_ID = \"product_features\" # @param {type: \"string\"}\n", + "FEATURE_GROUP_ID = \"product_features_unique\" # @param {type: \"string\"}\n", "FEATURE_IDS = [\n", " \"good_order_count\",\n", " \"bad_order_count\",\n", @@ -1090,8 +1090,10 @@ "outputs": [], "source": [ "data_client.fetch_feature_values(\n", - " feature_view=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}/featureViews/{FEATURE_VIEW_ID}\",\n", - " id=\"28098\",\n", + " request=feature_online_store_service_pb2.FetchFeatureValuesRequest(\n", + " feature_view=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}/featureViews/{FEATURE_VIEW_ID}\",\n", + " id=\"28098\",\n", + " )\n", ")" ] }, diff --git a/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb b/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb index 856e5176c..b2cf2835e 100644 --- a/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb +++ b/notebooks/official/feature_store/online_feature_serving_and_fetching_bigquery_data_with_feature_store_optimized.ipynb @@ -642,23 +642,28 @@ }, "outputs": [], "source": [ - "FEATURE_ONLINE_STORE_ID = \"the_look_demo_optimized_private\" # @param {type:\"string\"}\n", + "FEATURE_ONLINE_STORE_ID = \"the_look_demo_optimized_private_unique\" # @param {type:\"string\"}\n", "\n", "online_store_config = feature_online_store_pb2.FeatureOnlineStore(\n", " optimized=feature_online_store_pb2.FeatureOnlineStore.Optimized(),\n", " dedicated_serving_endpoint=feature_online_store_pb2.FeatureOnlineStore.DedicatedServingEndpoint(\n", " private_service_connect_config=service_networking_pb2.PrivateServiceConnectConfig(\n", - " enable_private_service_connect=True,\n", - " project_allowlist=[\"your_allow_listed_project1\", \"your_allow_listed_project2\"],\n", + " enable_private_service_connect=True,\n", + " project_allowlist=[\n", + " \"your_allow_listed_project1\",\n", + " \"your_allow_listed_project2\",\n", + " ],\n", " )\n", - " )\n", + " ),\n", ")\n", "\n", "create_store_lro = admin_client.create_feature_online_store(\n", " feature_online_store_admin_service_pb2.CreateFeatureOnlineStoreRequest(\n", " parent=f\"projects/{PROJECT_ID}/locations/{REGION}\",\n", " feature_online_store_id=FEATURE_ONLINE_STORE_ID,\n", - " feature_online_store=online_store_config))" + " feature_online_store=online_store_config,\n", + " )\n", + ")" ] }, { @@ -684,7 +689,7 @@ }, "outputs": [], "source": [ - "FEATURE_ONLINE_STORE_ID = \"the_look_demo_optimized_public\" # @param {type:\"string\"}\n", + "FEATURE_ONLINE_STORE_ID = \"the_look_demo_optimized_public_unique\" # @param {type:\"string\"}\n", "\n", "online_store_config = feature_online_store_pb2.FeatureOnlineStore(\n", " optimized=feature_online_store_pb2.FeatureOnlineStore.Optimized()\n", @@ -695,7 +700,9 @@ " feature_online_store_admin_service_pb2.CreateFeatureOnlineStoreRequest(\n", " parent=f\"projects/{PROJECT_ID}/locations/{REGION}\",\n", " feature_online_store_id=FEATURE_ONLINE_STORE_ID,\n", - " feature_online_store=online_store_config))" + " feature_online_store=online_store_config,\n", + " )\n", + ")" ] }, { @@ -876,7 +883,7 @@ }, "outputs": [], "source": [ - "FEATURE_GROUP_ID = \"product_features\" # @param {type: \"string\"}\n", + "FEATURE_GROUP_ID = \"product_features_unique\" # @param {type: \"string\"}\n", "FEATURE_IDS = [\n", " \"good_order_count\",\n", " \"bad_order_count\",\n", @@ -1163,7 +1170,8 @@ "source": [ "# Get Optimized online store\n", "admin_client.get_feature_online_store(\n", - " name=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}\")" + " name=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}\"\n", + ")" ] }, { @@ -1266,8 +1274,9 @@ "outputs": [], "source": [ "# data_client.fetch_feature_values(\n", - "# feature_view=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}/featureViews/{FEATURE_VIEW_ID}\",\n", - "# id=\"16050\")" + "# request=feature_online_store_service_pb2.FetchFeatureValuesRequest(\n", + "# feature_view=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}/featureViews/{FEATURE_VIEW_ID}\",\n", + "# id=\"16050\"))" ] }, { @@ -1302,7 +1311,8 @@ "source": [ "# Get Optimized online store\n", "response = admin_client.get_feature_online_store(\n", - " name=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}\")" + " name=f\"projects/{PROJECT_ID}/locations/{REGION}/featureOnlineStores/{FEATURE_ONLINE_STORE_ID}\"\n", + ")" ] }, { @@ -1331,7 +1341,9 @@ "outputs": [], "source": [ "data_client = FeatureOnlineStoreServiceClient(\n", - " client_options={\"api_endpoint\": response.dedicated_serving_endpoint.public_endpoint_domain_name}\n", + " client_options={\n", + " \"api_endpoint\": response.dedicated_serving_endpoint.public_endpoint_domain_name\n", + " }\n", ")" ] },