Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ class MaterializeRequest(BaseModel):
end_ts: Optional[str] = None
feature_views: Optional[List[str]] = None
disable_event_timestamp: bool = False
full_feature_names: bool = False


class MaterializeIncrementalRequest(BaseModel):
end_ts: str
feature_views: Optional[List[str]] = None
full_feature_names: bool = False


class GetOnlineFeaturesRequest(BaseModel):
Expand Down Expand Up @@ -470,6 +472,7 @@ async def materialize(request: MaterializeRequest) -> None:
end_date,
request.feature_views,
disable_event_timestamp=request.disable_event_timestamp,
full_feature_names=request.full_feature_names,
)

@app.post("/materialize-incremental", dependencies=[Depends(inject_user_details)])
Expand All @@ -484,6 +487,7 @@ async def materialize_incremental(request: MaterializeIncrementalRequest) -> Non
store.materialize_incremental,
utils.make_tzaware(parser.parse(request.end_ts)),
request.feature_views,
full_feature_names=request.full_feature_names,
)

@app.exception_handler(Exception)
Expand Down
22 changes: 20 additions & 2 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ def _materialize_odfv(
feature_view: OnDemandFeatureView,
start_date: datetime,
end_date: datetime,
full_feature_names: bool,
):
"""Helper to materialize a single OnDemandFeatureView."""
if not feature_view.source_feature_view_projections:
Expand Down Expand Up @@ -1428,6 +1429,7 @@ def _materialize_odfv(
retrieval_job = self.get_historical_features(
entity_df=entity_df,
features=source_features_from_projections,
full_feature_names=full_feature_names,
)
input_df = retrieval_job.to_df()
transformed_df = self._transform_on_demand_feature_view_df(
Expand All @@ -1439,6 +1441,7 @@ def materialize_incremental(
self,
end_date: datetime,
feature_views: Optional[List[str]] = None,
full_feature_names: bool = False,
) -> None:
"""
Materialize incremental new data from the offline store into the online store.
Expand All @@ -1453,6 +1456,8 @@ def materialize_incremental(
end_date (datetime): End date for time range of data to materialize into the online store
feature_views (List[str]): Optional list of feature view names. If selected, will only run
materialization for the specified feature views.
full_feature_names (bool): If True, feature names will be prefixed with the corresponding
feature view name.

Raises:
Exception: A feature view being materialized does not have a TTL set.
Expand Down Expand Up @@ -1498,7 +1503,12 @@ def materialize_incremental(
print(
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
)
self._materialize_odfv(feature_view, odfv_start_date, end_date)
self._materialize_odfv(
feature_view,
odfv_start_date,
end_date,
full_feature_names=full_feature_names,
)
continue

start_date = feature_view.most_recent_end_time
Expand Down Expand Up @@ -1554,6 +1564,7 @@ def materialize(
end_date: datetime,
feature_views: Optional[List[str]] = None,
disable_event_timestamp: bool = False,
full_feature_names: bool = False,
) -> None:
"""
Materialize data from the offline store into the online store.
Expand All @@ -1568,6 +1579,8 @@ def materialize(
feature_views (List[str]): Optional list of feature view names. If selected, will only run
materialization for the specified feature views.
disable_event_timestamp (bool): If True, materializes all available data using current datetime as event timestamp instead of source event timestamps
full_feature_names (bool): If True, feature names will be prefixed with the corresponding
feature view name.

Examples:
Materialize all features into the online store over the interval
Expand Down Expand Up @@ -1603,7 +1616,12 @@ def materialize(
print(
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
)
self._materialize_odfv(feature_view, start_date, end_date)
self._materialize_odfv(
feature_view,
start_date,
end_date,
full_feature_names=full_feature_names,
)
continue
provider = self._get_provider()
print(f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:")
Expand Down
Loading