@@ -49,7 +49,8 @@ def get_feature_sets(self, feature_set_names: List[str] = None) -> List[FeatureS
4949 :return: List[FeatureSet] the list of Feature Sets
5050 """
5151
52- r = make_request (self ._FS_URL , Endpoints .FEATURE_SETS , RequestType .GET , self ._basic_auth , { "name" : feature_set_names } if feature_set_names else None )
52+ r = make_request (self ._FS_URL , Endpoints .FEATURE_SETS , RequestType .GET , self ._basic_auth ,
53+ { "name" : feature_set_names } if feature_set_names else None )
5354 return [FeatureSet (** fs ) for fs in r ]
5455
5556 def remove_training_view (self , override = False ):
@@ -127,10 +128,6 @@ def get_features_by_name(self, names: Optional[List[str]] = None, as_list=False)
127128 r = make_request (self ._FS_URL , Endpoints .FEATURES , RequestType .GET , self ._basic_auth , { "name" : names })
128129 return [Feature (** f ) for f in r ] if as_list else pd .DataFrame .from_dict (r )
129130
130- def remove_feature_set (self ):
131- # TODO
132- raise NotImplementedError
133-
134131 def get_feature_vector (self , features : List [Union [str , Feature ]],
135132 join_key_values : Dict [str , str ], return_sql = False ) -> Union [str , PandasDF ]:
136133 """
@@ -184,7 +181,8 @@ def get_training_view_features(self, training_view: str) -> List[Feature]:
184181 :return: A list of available Feature objects
185182 """
186183
187- r = make_request (self ._FS_URL , Endpoints .TRAINING_VIEW_FEATURES , RequestType .GET , self ._basic_auth , { "view" : training_view })
184+ r = make_request (self ._FS_URL , Endpoints .TRAINING_VIEW_FEATURES , RequestType .GET ,
185+ self ._basic_auth , { "view" : training_view })
188186 return [Feature (** f ) for f in r ]
189187
190188 def get_feature_description (self ):
@@ -601,6 +599,28 @@ def get_training_set_features(self, training_set: str = None):
601599 r ['features' ] = [Feature (** f ) for f in r ['features' ]]
602600 return r
603601
602+ def remove_feature_set (self , schema : str , table : str , purge : bool = False ) -> None :
603+ """
604+ Deletes a feature set if appropriate. You can currently delete a feature set in two scenarios:
605+ 1. The feature set has not been deployed
606+ 2. The feature set has been deployed, but not linked to any training sets
607+
608+ If both of these conditions are false, this will fail.
609+
610+ Optionally set purge=True to force delete the feature set and all of the associated Training Sets using the
611+ Feature Set. ONLY USE IF YOU KNOW WHAT YOU ARE DOING. This will delete Training Sets, but will still fail if
612+ there is an active deployment with this feature set. That cannot be overwritten
613+
614+ :param schema: The Feature Set Schema
615+ :param table: The Feature Set Table
616+ :param purge: Whether to force delete training sets that use the feature set (that are not used in deployments)
617+ """
618+ if purge :
619+ warnings .warn ("You've set purge=True, I hope you know what you are doing! This will delete any dependent"
620+ " Training Sets (except ones used in an active model deployment)" )
621+ make_request (self ._FS_URL , Endpoints .FEATURE_SETS ,
622+ RequestType .DELETE , self ._basic_auth , { "schema" : schema , "table" :table , "purge" : purge })
623+
604624 def _retrieve_model_data_sets (self , schema_name : str , table_name : str ):
605625 """
606626 Returns the training set dataframe and model table dataframe for a given deployed model.
0 commit comments