Skip to content

Commit b9d9d1c

Browse files
committed
add possibility to force full features names for materialize ops
Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
1 parent 75d13db commit b9d9d1c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

sdk/python/feast/feature_server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ class MaterializeRequest(BaseModel):
7878
end_ts: Optional[str] = None
7979
feature_views: Optional[List[str]] = None
8080
disable_event_timestamp: bool = False
81+
full_feature_names: bool = False
8182

8283

8384
class MaterializeIncrementalRequest(BaseModel):
8485
end_ts: str
8586
feature_views: Optional[List[str]] = None
87+
full_feature_names: bool = False
8688

8789

8890
class GetOnlineFeaturesRequest(BaseModel):
@@ -470,6 +472,7 @@ async def materialize(request: MaterializeRequest) -> None:
470472
end_date,
471473
request.feature_views,
472474
disable_event_timestamp=request.disable_event_timestamp,
475+
full_feature_names=request.full_feature_names,
473476
)
474477

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

489493
@app.exception_handler(Exception)

sdk/python/feast/feature_store.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ def _materialize_odfv(
13311331
feature_view: OnDemandFeatureView,
13321332
start_date: datetime,
13331333
end_date: datetime,
1334+
full_feature_names: bool,
13341335
):
13351336
"""Helper to materialize a single OnDemandFeatureView."""
13361337
if not feature_view.source_feature_view_projections:
@@ -1428,6 +1429,7 @@ def _materialize_odfv(
14281429
retrieval_job = self.get_historical_features(
14291430
entity_df=entity_df,
14301431
features=source_features_from_projections,
1432+
full_feature_names=full_feature_names,
14311433
)
14321434
input_df = retrieval_job.to_df()
14331435
transformed_df = self._transform_on_demand_feature_view_df(
@@ -1439,6 +1441,7 @@ def materialize_incremental(
14391441
self,
14401442
end_date: datetime,
14411443
feature_views: Optional[List[str]] = None,
1444+
full_feature_names: bool = False,
14421445
) -> None:
14431446
"""
14441447
Materialize incremental new data from the offline store into the online store.
@@ -1453,6 +1456,8 @@ def materialize_incremental(
14531456
end_date (datetime): End date for time range of data to materialize into the online store
14541457
feature_views (List[str]): Optional list of feature view names. If selected, will only run
14551458
materialization for the specified feature views.
1459+
full_feature_names (bool): If True, feature names will be prefixed with the corresponding
1460+
feature view name.
14561461
14571462
Raises:
14581463
Exception: A feature view being materialized does not have a TTL set.
@@ -1498,7 +1503,12 @@ def materialize_incremental(
14981503
print(
14991504
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
15001505
)
1501-
self._materialize_odfv(feature_view, odfv_start_date, end_date)
1506+
self._materialize_odfv(
1507+
feature_view,
1508+
odfv_start_date,
1509+
end_date,
1510+
full_feature_names=full_feature_names,
1511+
)
15021512
continue
15031513

15041514
start_date = feature_view.most_recent_end_time
@@ -1554,6 +1564,7 @@ def materialize(
15541564
end_date: datetime,
15551565
feature_views: Optional[List[str]] = None,
15561566
disable_event_timestamp: bool = False,
1567+
full_feature_names: bool = False,
15571568
) -> None:
15581569
"""
15591570
Materialize data from the offline store into the online store.
@@ -1568,6 +1579,8 @@ def materialize(
15681579
feature_views (List[str]): Optional list of feature view names. If selected, will only run
15691580
materialization for the specified feature views.
15701581
disable_event_timestamp (bool): If True, materializes all available data using current datetime as event timestamp instead of source event timestamps
1582+
full_feature_names (bool): If True, feature names will be prefixed with the corresponding
1583+
feature view name.
15711584
15721585
Examples:
15731586
Materialize all features into the online store over the interval
@@ -1603,7 +1616,12 @@ def materialize(
16031616
print(
16041617
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
16051618
)
1606-
self._materialize_odfv(feature_view, start_date, end_date)
1619+
self._materialize_odfv(
1620+
feature_view,
1621+
start_date,
1622+
end_date,
1623+
full_feature_names=full_feature_names,
1624+
)
16071625
continue
16081626
provider = self._get_provider()
16091627
print(f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:")

0 commit comments

Comments
 (0)