@@ -207,14 +207,14 @@ def get_stream_feature_view(
207
207
self , name : str , project : str , allow_cache : bool = False
208
208
):
209
209
return self ._get_object (
210
- stream_feature_views ,
211
- name ,
212
- project ,
213
- StreamFeatureViewProto ,
214
- StreamFeatureView ,
215
- "feature_view_name" ,
216
- "feature_view_proto" ,
217
- FeatureViewNotFoundException ,
210
+ table = stream_feature_views ,
211
+ name = name ,
212
+ project = project ,
213
+ proto_class = StreamFeatureViewProto ,
214
+ python_class = StreamFeatureView ,
215
+ id_field_name = "feature_view_name" ,
216
+ proto_field_name = "feature_view_proto" ,
217
+ not_found_exception = FeatureViewNotFoundException ,
218
218
)
219
219
220
220
def list_stream_feature_views (
@@ -230,101 +230,105 @@ def list_stream_feature_views(
230
230
231
231
def apply_entity (self , entity : Entity , project : str , commit : bool = True ):
232
232
return self ._apply_object (
233
- entities , project , "entity_name" , entity , "entity_proto"
233
+ table = entities ,
234
+ project = project ,
235
+ id_field_name = "entity_name" ,
236
+ obj = entity ,
237
+ proto_field_name = "entity_proto" ,
234
238
)
235
239
236
240
def get_entity (self , name : str , project : str , allow_cache : bool = False ) -> Entity :
237
241
return self ._get_object (
238
- entities ,
239
- name ,
240
- project ,
241
- EntityProto ,
242
- Entity ,
243
- "entity_name" ,
244
- "entity_proto" ,
245
- EntityNotFoundException ,
242
+ table = entities ,
243
+ name = name ,
244
+ project = project ,
245
+ proto_class = EntityProto ,
246
+ python_class = Entity ,
247
+ id_field_name = "entity_name" ,
248
+ proto_field_name = "entity_proto" ,
249
+ not_found_exception = EntityNotFoundException ,
246
250
)
247
251
248
252
def get_feature_view (
249
253
self , name : str , project : str , allow_cache : bool = False
250
254
) -> FeatureView :
251
255
return self ._get_object (
252
- feature_views ,
253
- name ,
254
- project ,
255
- FeatureViewProto ,
256
- FeatureView ,
257
- "feature_view_name" ,
258
- "feature_view_proto" ,
259
- FeatureViewNotFoundException ,
256
+ table = feature_views ,
257
+ name = name ,
258
+ project = project ,
259
+ proto_class = FeatureViewProto ,
260
+ python_class = FeatureView ,
261
+ id_field_name = "feature_view_name" ,
262
+ proto_field_name = "feature_view_proto" ,
263
+ not_found_exception = FeatureViewNotFoundException ,
260
264
)
261
265
262
266
def get_on_demand_feature_view (
263
267
self , name : str , project : str , allow_cache : bool = False
264
268
) -> OnDemandFeatureView :
265
269
return self ._get_object (
266
- on_demand_feature_views ,
267
- name ,
268
- project ,
269
- OnDemandFeatureViewProto ,
270
- OnDemandFeatureView ,
271
- "feature_view_name" ,
272
- "feature_view_proto" ,
273
- FeatureViewNotFoundException ,
270
+ table = on_demand_feature_views ,
271
+ name = name ,
272
+ project = project ,
273
+ proto_class = OnDemandFeatureViewProto ,
274
+ python_class = OnDemandFeatureView ,
275
+ id_field_name = "feature_view_name" ,
276
+ proto_field_name = "feature_view_proto" ,
277
+ not_found_exception = FeatureViewNotFoundException ,
274
278
)
275
279
276
280
def get_request_feature_view (self , name : str , project : str ):
277
281
return self ._get_object (
278
- request_feature_views ,
279
- name ,
280
- project ,
281
- RequestFeatureViewProto ,
282
- RequestFeatureView ,
283
- "feature_view_name" ,
284
- "feature_view_proto" ,
285
- FeatureViewNotFoundException ,
282
+ table = request_feature_views ,
283
+ name = name ,
284
+ project = project ,
285
+ proto_class = RequestFeatureViewProto ,
286
+ python_class = RequestFeatureView ,
287
+ id_field_name = "feature_view_name" ,
288
+ proto_field_name = "feature_view_proto" ,
289
+ not_found_exception = FeatureViewNotFoundException ,
286
290
)
287
291
288
292
def get_feature_service (
289
293
self , name : str , project : str , allow_cache : bool = False
290
294
) -> FeatureService :
291
295
return self ._get_object (
292
- feature_services ,
293
- name ,
294
- project ,
295
- FeatureServiceProto ,
296
- FeatureService ,
297
- "feature_service_name" ,
298
- "feature_service_proto" ,
299
- FeatureServiceNotFoundException ,
296
+ table = feature_services ,
297
+ name = name ,
298
+ project = project ,
299
+ proto_class = FeatureServiceProto ,
300
+ python_class = FeatureService ,
301
+ id_field_name = "feature_service_name" ,
302
+ proto_field_name = "feature_service_proto" ,
303
+ not_found_exception = FeatureServiceNotFoundException ,
300
304
)
301
305
302
306
def get_saved_dataset (
303
307
self , name : str , project : str , allow_cache : bool = False
304
308
) -> SavedDataset :
305
309
return self ._get_object (
306
- saved_datasets ,
307
- name ,
308
- project ,
309
- SavedDatasetProto ,
310
- SavedDataset ,
311
- "saved_dataset_name" ,
312
- "saved_dataset_proto" ,
313
- SavedDatasetNotFound ,
310
+ table = saved_datasets ,
311
+ name = name ,
312
+ project = project ,
313
+ proto_class = SavedDatasetProto ,
314
+ python_class = SavedDataset ,
315
+ id_field_name = "saved_dataset_name" ,
316
+ proto_field_name = "saved_dataset_proto" ,
317
+ not_found_exception = SavedDatasetNotFound ,
314
318
)
315
319
316
320
def get_validation_reference (
317
321
self , name : str , project : str , allow_cache : bool = False
318
322
) -> ValidationReference :
319
323
return self ._get_object (
320
- validation_references ,
321
- name ,
322
- project ,
323
- ValidationReferenceProto ,
324
- ValidationReference ,
325
- "validation_reference_name" ,
326
- "validation_reference_proto" ,
327
- ValidationReferenceNotFound ,
324
+ table = validation_references ,
325
+ name = name ,
326
+ project = project ,
327
+ proto_class = ValidationReferenceProto ,
328
+ python_class = ValidationReference ,
329
+ id_field_name = "validation_reference_name" ,
330
+ proto_field_name = "validation_reference_proto" ,
331
+ not_found_exception = ValidationReferenceNotFound ,
328
332
)
329
333
330
334
def list_entities (self , project : str , allow_cache : bool = False ) -> List [Entity ]:
@@ -364,14 +368,14 @@ def get_data_source(
364
368
self , name : str , project : str , allow_cache : bool = False
365
369
) -> DataSource :
366
370
return self ._get_object (
367
- data_sources ,
368
- name ,
369
- project ,
370
- DataSourceProto ,
371
- DataSource ,
372
- "data_source_name" ,
373
- "data_source_proto" ,
374
- DataSourceObjectNotFoundException ,
371
+ table = data_sources ,
372
+ name = name ,
373
+ project = project ,
374
+ proto_class = DataSourceProto ,
375
+ python_class = DataSource ,
376
+ id_field_name = "data_source_name" ,
377
+ proto_field_name = "data_source_proto" ,
378
+ not_found_exception = DataSourceObjectNotFoundException ,
375
379
)
376
380
377
381
def list_data_sources (
@@ -556,22 +560,28 @@ def delete_validation_reference(self, name: str, project: str, commit: bool = Tr
556
560
557
561
def update_infra (self , infra : Infra , project : str , commit : bool = True ):
558
562
self ._apply_object (
559
- managed_infra , project , "infra_name" , infra , "infra_proto" , name = "infra_obj"
563
+ table = managed_infra ,
564
+ project = project ,
565
+ id_field_name = "infra_name" ,
566
+ obj = infra ,
567
+ proto_field_name = "infra_proto" ,
568
+ name = "infra_obj" ,
560
569
)
561
570
562
571
def get_infra (self , project : str , allow_cache : bool = False ) -> Infra :
563
572
infra_object = self ._get_object (
564
- managed_infra ,
565
- "infra_obj" ,
566
- project ,
567
- InfraProto ,
568
- Infra ,
569
- "infra_name" ,
570
- "infra_proto" ,
571
- None ,
573
+ table = managed_infra ,
574
+ name = "infra_obj" ,
575
+ project = project ,
576
+ proto_class = InfraProto ,
577
+ python_class = Infra ,
578
+ id_field_name = "infra_name" ,
579
+ proto_field_name = "infra_proto" ,
580
+ not_found_exception = None ,
572
581
)
573
- infra_object = infra_object or InfraProto ()
574
- return Infra .from_proto (infra_object )
582
+ if infra_object :
583
+ return infra_object
584
+ return Infra ()
575
585
576
586
def apply_user_metadata (
577
587
self ,
0 commit comments