1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414import os
15+ import warnings
1516from collections import Counter , OrderedDict , defaultdict
1617from datetime import datetime , timedelta
1718from pathlib import Path
4344from feast .usage import log_exceptions , log_exceptions_and_usage
4445from feast .version import get_version
4546
47+ warnings .simplefilter ("once" , DeprecationWarning )
48+
4649
4750class FeatureStore :
4851 """
@@ -219,7 +222,7 @@ def delete_feature_view(self, name: str):
219222
220223 def _get_features (
221224 self ,
222- features : Union [List [str ], FeatureService ],
225+ features : Optional [ Union [List [str ], FeatureService ] ],
223226 feature_refs : Optional [List [str ]],
224227 ) -> List [str ]:
225228 _features = features or feature_refs
@@ -342,7 +345,7 @@ def teardown(self):
342345 def get_historical_features (
343346 self ,
344347 entity_df : Union [pd .DataFrame , str ],
345- features : Union [List [str ], FeatureService ],
348+ features : Optional [ Union [List [str ], FeatureService ]] = None ,
346349 feature_refs : Optional [List [str ]] = None ,
347350 full_feature_names : bool = False ,
348351 ) -> RetrievalJob :
@@ -374,6 +377,9 @@ def get_historical_features(
374377 Returns:
375378 RetrievalJob which can be used to materialize the results.
376379
380+ Raises:
381+ ValueError: Both or neither of features and feature_refs are specified.
382+
377383 Examples:
378384 Retrieve historical features using a BigQuery SQL entity dataframe
379385
@@ -387,6 +393,22 @@ def get_historical_features(
387393 >>> feature_data = retrieval_job.to_df()
388394 >>> model.fit(feature_data) # insert your modeling framework here.
389395 """
396+ if (features is not None and feature_refs is not None ) or (
397+ features is None and feature_refs is None
398+ ):
399+ raise ValueError (
400+ "You must specify exactly one of features and feature_refs."
401+ )
402+
403+ if feature_refs :
404+ warnings .warn (
405+ (
406+ "The argument 'feature_refs' is being deprecated. Please use 'features' "
407+ "instead. Feast 0.13 and onwards will not support the argument 'feature_refs'."
408+ ),
409+ DeprecationWarning ,
410+ )
411+
390412 _feature_refs = self ._get_features (features , feature_refs )
391413
392414 all_feature_views = self ._registry .list_feature_views (project = self .project )
0 commit comments