def delete_feature_table(self, name: str, project: str, commit: bool = True): """ Deletes a feature table or raises an exception if not found. Args: name: Name of feature table project: Feast project that this feature table belongs to commit: Whether the change should be persisted immediately """ self._prepare_registry_for_changes() assert self.cached_registry_proto for idx, existing_feature_table_proto in enumerate( self.cached_registry_proto.feature_tables): if (existing_feature_table_proto.spec.name == name and existing_feature_table_proto.spec.project == project): del self.cached_registry_proto.feature_tables[idx] if commit: self.commit() return raise FeatureTableNotFoundException(name, project)
def updater(registry_proto: RegistryProto): for idx, existing_feature_table_proto in enumerate( registry_proto.feature_tables): if (existing_feature_table_proto.spec.name == name and existing_feature_table_proto.spec.project == project): del registry_proto.feature_tables[idx] return registry_proto raise FeatureTableNotFoundException(project, name)
def get_feature_table(self, name: str, project: str) -> FeatureTable: """ Retrieves a feature table. Args: name: Name of feature table project: Feast project that this feature table belongs to Returns: Returns either the specified feature table, or raises an exception if none is found """ registry_proto = self._get_registry_proto() for feature_table_proto in registry_proto.feature_tables: if (feature_table_proto.spec.name == name and feature_table_proto.spec.project == project): return FeatureTable.from_proto(feature_table_proto) raise FeatureTableNotFoundException(project, name)