Skip to content

Commit 949ba3d

Browse files
authored
fix: Date wise remote offline store historical data retrieval (#5686)
* Added start_date & end_date range for historical data retrieval from RemoteOfflineStore Signed-off-by: Aniket Paluskar <[email protected]> * Minor linting & reformatting changes Signed-off-by: Aniket Paluskar <[email protected]> --------- Signed-off-by: Aniket Paluskar <[email protected]>
1 parent 564e965 commit 949ba3d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

sdk/python/feast/infra/offline_stores/remote.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def get_historical_features(
197197
registry: BaseRegistry,
198198
project: str,
199199
full_feature_names: bool = False,
200+
**kwargs,
200201
) -> RemoteRetrievalJob:
201202
assert isinstance(config.offline_store, RemoteOfflineStoreConfig)
202203

@@ -219,6 +220,15 @@ def get_historical_features(
219220
"name_aliases": name_aliases,
220221
}
221222

223+
# Extract and serialize start_date/end_date for remote transmission
224+
start_date = kwargs.get("start_date", None)
225+
end_date = kwargs.get("end_date", None)
226+
227+
if start_date is not None:
228+
api_parameters["start_date"] = start_date.isoformat()
229+
if end_date is not None:
230+
api_parameters["end_date"] = end_date.isoformat()
231+
222232
return RemoteRetrievalJob(
223233
client=client,
224234
api=OfflineStore.get_historical_features.__name__,

sdk/python/feast/offline_server.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,17 @@ def get_historical_features(self, command: dict, key: Optional[str] = None):
449449
resource=feature_view, actions=[AuthzedAction.READ_OFFLINE]
450450
)
451451

452+
# Extract and deserialize start_date/end_date if present
453+
kwargs = {}
454+
if "start_date" in command and command["start_date"] is not None:
455+
kwargs["start_date"] = utils.make_tzaware(
456+
datetime.fromisoformat(command["start_date"])
457+
)
458+
if "end_date" in command and command["end_date"] is not None:
459+
kwargs["end_date"] = utils.make_tzaware(
460+
datetime.fromisoformat(command["end_date"])
461+
)
462+
452463
retJob = self.offline_store.get_historical_features(
453464
config=self.store.config,
454465
feature_views=feature_views,
@@ -457,6 +468,7 @@ def get_historical_features(self, command: dict, key: Optional[str] = None):
457468
registry=self.store.registry,
458469
project=project,
459470
full_feature_names=full_feature_names,
471+
**kwargs,
460472
)
461473

462474
return retJob

0 commit comments

Comments
 (0)