@@ -123,16 +123,21 @@ def __init__(
123
123
location = self .location , credentials = credentials ,
124
124
)
125
125
126
- @property
127
- def featurestore_name (self ) -> str :
128
- """Full qualified resource name of the managed featurestore in which this EntityType is."""
126
+ def _get_featurestore_name (self ) -> str :
127
+ """Gets full qualified resource name of the managed featurestore in which this EntityType is."""
129
128
entity_type_name_components = self ._parse_resource_name (self .resource_name )
130
129
return featurestore .Featurestore ._format_resource_name (
131
130
project = entity_type_name_components ["project" ],
132
131
location = entity_type_name_components ["location" ],
133
132
featurestore = entity_type_name_components ["featurestore" ],
134
133
)
135
134
135
+ @property
136
+ def featurestore_name (self ) -> str :
137
+ """Full qualified resource name of the managed featurestore in which this EntityType is."""
138
+ self .wait ()
139
+ return self ._get_featurestore_name ()
140
+
136
141
def get_featurestore (self ) -> "featurestore.Featurestore" :
137
142
"""Retrieves the managed featurestore in which this EntityType is.
138
143
@@ -141,7 +146,7 @@ def get_featurestore(self) -> "featurestore.Featurestore":
141
146
"""
142
147
return featurestore .Featurestore (self .featurestore_name )
143
148
144
- def get_feature (self , feature_id : str ) -> "featurestore.Feature" :
149
+ def _get_feature (self , feature_id : str ) -> "featurestore.Feature" :
145
150
"""Retrieves an existing managed feature in this EntityType.
146
151
147
152
Args:
@@ -151,7 +156,6 @@ def get_feature(self, feature_id: str) -> "featurestore.Feature":
151
156
featurestore.Feature - The managed feature resource object.
152
157
"""
153
158
entity_type_name_components = self ._parse_resource_name (self .resource_name )
154
-
155
159
return featurestore .Feature (
156
160
feature_name = featurestore .Feature ._format_resource_name (
157
161
project = entity_type_name_components ["project" ],
@@ -162,6 +166,18 @@ def get_feature(self, feature_id: str) -> "featurestore.Feature":
162
166
)
163
167
)
164
168
169
+ def get_feature (self , feature_id : str ) -> "featurestore.Feature" :
170
+ """Retrieves an existing managed feature in this EntityType.
171
+
172
+ Args:
173
+ feature_id (str):
174
+ Required. The managed feature resource ID in this EntityType.
175
+ Returns:
176
+ featurestore.Feature - The managed feature resource object.
177
+ """
178
+ self .wait ()
179
+ return self ._get_feature (feature_id = feature_id )
180
+
165
181
def update (
166
182
self ,
167
183
description : Optional [str ] = None ,
@@ -202,6 +218,7 @@ def update(
202
218
Returns:
203
219
EntityType - The updated entityType resource object.
204
220
"""
221
+ self .wait ()
205
222
update_mask = list ()
206
223
207
224
if description :
@@ -380,6 +397,7 @@ def list_features(
380
397
Returns:
381
398
List[featurestore.Feature] - A list of managed feature resource objects.
382
399
"""
400
+ self .wait ()
383
401
return featurestore .Feature .list (
384
402
entity_type_name = self .resource_name , filter = filter , order_by = order_by ,
385
403
)
@@ -399,7 +417,7 @@ def delete_features(self, feature_ids: List[str], sync: bool = True,) -> None:
399
417
"""
400
418
features = []
401
419
for feature_id in feature_ids :
402
- feature = self .get_feature (feature_id = feature_id )
420
+ feature = self ._get_feature (feature_id = feature_id )
403
421
feature .delete (sync = False )
404
422
features .append (feature )
405
423
@@ -626,6 +644,7 @@ def create_feature(
626
644
featurestore.Feature - feature resource object
627
645
628
646
"""
647
+ self .wait ()
629
648
return featurestore .Feature .create (
630
649
feature_id = feature_id ,
631
650
value_type = value_type ,
@@ -761,8 +780,9 @@ def batch_create_features(
761
780
762
781
return self
763
782
783
+ @staticmethod
764
784
def _validate_and_get_import_feature_values_request (
765
- self ,
785
+ entity_type_name : str ,
766
786
feature_ids : List [str ],
767
787
feature_time : Union [str , datetime .datetime ],
768
788
data_source : Union [gca_io .AvroSource , gca_io .BigQuerySource , gca_io .CsvSource ],
@@ -773,6 +793,8 @@ def _validate_and_get_import_feature_values_request(
773
793
) -> gca_featurestore_service .ImportFeatureValuesRequest :
774
794
"""Validates and get import feature values request.
775
795
Args:
796
+ entity_type_name (str):
797
+ Required. A fully-qualified entityType resource name.
776
798
feature_ids (List[str]):
777
799
Required. IDs of the Feature to import values
778
800
of. The Features must exist in the target
@@ -840,7 +862,7 @@ def _validate_and_get_import_feature_values_request(
840
862
]
841
863
842
864
import_feature_values_request = gca_featurestore_service .ImportFeatureValuesRequest (
843
- entity_type = self . resource_name ,
865
+ entity_type = entity_type_name ,
844
866
feature_specs = feature_specs ,
845
867
entity_id_field = entity_id_field ,
846
868
disable_online_serving = disable_online_serving ,
@@ -992,6 +1014,7 @@ def ingest_from_bq(
992
1014
bigquery_source = gca_io .BigQuerySource (input_uri = bq_source_uri )
993
1015
994
1016
import_feature_values_request = self ._validate_and_get_import_feature_values_request (
1017
+ entity_type_name = self .resource_name ,
995
1018
feature_ids = feature_ids ,
996
1019
feature_time = feature_time ,
997
1020
data_source = bigquery_source ,
@@ -1114,6 +1137,7 @@ def ingest_from_gcs(
1114
1137
data_source = gca_io .AvroSource (gcs_source = gcs_source )
1115
1138
1116
1139
import_feature_values_request = self ._validate_and_get_import_feature_values_request (
1140
+ entity_type_name = self .resource_name ,
1117
1141
feature_ids = feature_ids ,
1118
1142
feature_time = feature_time ,
1119
1143
data_source = data_source ,
@@ -1213,6 +1237,7 @@ def ingest_from_df(
1213
1237
project = self .project , credentials = self .credentials
1214
1238
)
1215
1239
1240
+ self .wait ()
1216
1241
entity_type_name_components = self ._parse_resource_name (self .resource_name )
1217
1242
featurestore_id , entity_type_id = (
1218
1243
entity_type_name_components ["featurestore" ],
@@ -1222,6 +1247,8 @@ def ingest_from_df(
1222
1247
temp_bq_dataset_name = f"temp_{ featurestore_id } _{ uuid .uuid4 ()} " .replace (
1223
1248
"-" , "_"
1224
1249
)
1250
+
1251
+ # TODO(b/216497263): Add support for resource project does not match initializer.global_config.project
1225
1252
temp_bq_dataset_id = f"{ initializer .global_config .project } .{ temp_bq_dataset_name } " [
1226
1253
:1024
1227
1254
]
@@ -1297,7 +1324,7 @@ def read(
1297
1324
Returns:
1298
1325
pd.DataFrame: entities' feature values in DataFrame
1299
1326
"""
1300
-
1327
+ self . wait ()
1301
1328
if isinstance (feature_ids , str ):
1302
1329
feature_ids = [feature_ids ]
1303
1330
@@ -1339,7 +1366,7 @@ def read(
1339
1366
feature_descriptor .id for feature_descriptor in header .feature_descriptors
1340
1367
]
1341
1368
1342
- return EntityType ._construct_dataframe (
1369
+ return self ._construct_dataframe (
1343
1370
feature_ids = feature_ids , entity_views = entity_views ,
1344
1371
)
1345
1372
0 commit comments