feast-dev / feast-dev/feast

How to get features for all entities in online serving?

Open
#1,361 4 comments 0 reactions 0 assignees View on GitHub
keep-open kind/feature priority/p2
Dominant language
Python
Stars
7.3k
Forks
1.4k
Avg merge
3d 16h
Merged PRs (30d)
15

Description

**Is your feature request related to a problem? Please describe.**
At inference time I would like to retrieve values of one given feature for all entities stored currently in a feature table, **without knowing what IDs the entities have**.
E.g. I would like to retrieve `trips_today` for **all** the drivers that are currently in `driver_trips` table.

**Describe the solution you'd like**
Ideally, I could do:
```
features = client.get_online_features(
feature_refs=["driver_trips:trips_today"],
entity_rows=None,
).to_dict()
```
and get
```
{
"driver_id": [... list of all the driver ids ...]
"driver_trips:trips_today": [... list of their respective feature values ...]
}
```

**Describe alternatives you've considered**
I could hack my way around by having a separate "meta" table which I update every time I add new entities. Something like:
```python
dummy = feast.entity.Entity(
name="dummy",
description="Dummy entity",
value_type=feast.value_type.ValueType.INT64
)

all_driver_ids = feast.feature.Feature("all_driver_ids", dtype=feast.value_type.ValueType.INT32_LIST)

meta_table = feast.feature_table.FeatureTable(
name = "meta_driver_table",
entities = ["dummy"],
features = [
all_driver_ids,
],
...
)
```
Then I could query this table for a known entity id, get the list of driver ids, and then query my actual feature table for all drivers. But that's a really hacky workaround.

**Additional context**
I realise it's kind of using Feast as a database. If this is totally out of Feast philosophy, please enlighten me. In such case, what alternative could I use?

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.