def apply_feature_table(self, feature_table: FeatureTable, project: str): """ Registers a single feature table with Feast Args: feature_table: Feature table that will be registered project: Feast project that this feature table belongs to """ feature_table.is_valid() feature_table_proto = feature_table.to_proto() feature_table_proto.spec.project = 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 == feature_table_proto.spec.name and existing_feature_table_proto.spec.project == project): del registry_proto.feature_tables[idx] registry_proto.feature_tables.append(feature_table_proto) return registry_proto registry_proto.feature_tables.append(feature_table_proto) return registry_proto self._registry_store.update_registry(updater) return
def apply_feature_table(self, feature_table: FeatureTable, project: str, commit: bool = True): """ Registers a single feature table with Feast Args: feature_table: Feature table that will be registered project: Feast project that this feature table belongs to commit: Whether the change should be persisted immediately """ feature_table.is_valid() feature_table_proto = feature_table.to_proto() feature_table_proto.spec.project = project 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 == feature_table_proto.spec.name and existing_feature_table_proto.spec.project == project): del self.cached_registry_proto.feature_tables[idx] break self.cached_registry_proto.feature_tables.append(feature_table_proto) if commit: self.commit()