From fdbfe34c63055026e8444fa7ab12ad3ebfd23e0e Mon Sep 17 00:00:00 2001 From: ammarar Date: Tue, 27 Sep 2022 13:01:38 -0700 Subject: [PATCH] add option to skip coercion Signed-off-by: ammarar --- sdk/python/feast/feature_store.py | 3 ++- sdk/python/feast/repo_config.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py index e534a5ffc93..9c722ff1a1c 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -1111,7 +1111,8 @@ def get_historical_features( # Check that the right request data is present in the entity_df if type(entity_df) == pd.DataFrame: - entity_df = utils.make_df_tzaware(cast(pd.DataFrame, entity_df)) + if self.config.coerce_tz_aware: + entity_df = utils.make_df_tzaware(cast(pd.DataFrame, entity_df)) for fv in request_feature_views: for feature in fv.features: if feature.name not in entity_df.columns: diff --git a/sdk/python/feast/repo_config.py b/sdk/python/feast/repo_config.py index d77707e5b14..c11b25849e3 100644 --- a/sdk/python/feast/repo_config.py +++ b/sdk/python/feast/repo_config.py @@ -167,6 +167,9 @@ class RepoConfig(FeastBaseModel): feature values for entities that have already been written into the online store. """ + coerce_tz_aware: Optional[bool] = True + """ If True, coerces entity_df timestamp columns to be timezone aware (to UTC by default). """ + def __init__(self, **data: Any): super().__init__(**data)