@@ -65,7 +65,7 @@ def select_all(self):
65
65
self ._feature_store_name , self ._feature_store_id , self , self ._features
66
66
)
67
67
68
- def select (self , features = []):
68
+ def select (self , features : List [ Union [ str , feature . Feature ]] = []):
69
69
"""Select a subset of features of the feature group and return a query object.
70
70
71
71
The query can be used to construct joins of feature groups or create a training
@@ -82,6 +82,33 @@ def select(self, features=[]):
82
82
self ._feature_store_name , self ._feature_store_id , self , features
83
83
)
84
84
85
+ def select_except (self , features : List [Union [str , feature .Feature ]] = []):
86
+ """Select all features of the feature group except a few and return a query
87
+ object.
88
+
89
+ The query can be used to construct joins of feature groups or create a training
90
+ dataset with a subset of features of the feature group.
91
+
92
+ # Arguments
93
+ features: list, optional. A list of `Feature` objects or feature names as
94
+ strings to be selected, defaults to [], selecting all features.
95
+
96
+ # Returns
97
+ `Query`: A query object with the selected features of the feature group.
98
+ """
99
+ if features :
100
+ except_features = [
101
+ f .name if isinstance (f , feature .Feature ) else f for f in features
102
+ ]
103
+ return query .Query (
104
+ self ._feature_store_name ,
105
+ self ._feature_store_id ,
106
+ self ,
107
+ [f for f in self ._features if f .name not in except_features ],
108
+ )
109
+ else :
110
+ return self .select_all ()
111
+
85
112
def filter (self , f : Union [filter .Filter , filter .Logic ]):
86
113
"""Apply filter to the feature group.
87
114
0 commit comments