Skip to content

Commit

Permalink
docs: Add docs example of how to use tags with feature views (#4536)
Browse files Browse the repository at this point in the history
* Add docs example of how to use tags with feature views

Signed-off-by: Theodor Mihalache <[email protected]>

* Add docs example of how to use tags with feature views
- changes following review

Signed-off-by: Theodor Mihalache <[email protected]>

---------

Signed-off-by: Theodor Mihalache <[email protected]>
  • Loading branch information
tmihalac authored Sep 19, 2024
1 parent 9688790 commit 1b92803
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/getting-started/concepts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@
{% content-ref url="permission.md" %}
[permission.md](permission.md)
{% endcontent-ref %}

{% content-ref url="tags.md" %}
[tags.md](tags.md)
{% endcontent-ref %}
59 changes: 59 additions & 0 deletions docs/getting-started/concepts/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Tags

## Overview

Tags in Feast allow for efficient filtering of Feast objects when listing them in the UI, CLI, or querying the registry directly.

The way to define tags on the feast objects is through the definition file or directly in the object that will be applied to the feature store.

## Examples

In this example we define a Feature View in a definition file that has a tag:
```python
driver_stats_fv = FeatureView(
name="driver_hourly_stats",
entities=[driver],
ttl=timedelta(days=1),
schema=[
Field(name="conv_rate", dtype=Float32),
Field(name="acc_rate", dtype=Float32),
Field(name="avg_daily_trips", dtype=Int64, description="Average daily trips"),
],
online=True,
source=driver_stats_source,
# Tags are user defined key/value pairs that are attached to each
# feature view
tags={"team": "driver_performance"},
)
```

In this example we define a Stream Feature View that has a tag, in the code:
```python
sfv = StreamFeatureView(
name="test kafka stream feature view",
entities=[entity],
schema=[],
description="desc",
timestamp_field="event_timestamp",
source=stream_source,
tags={"team": "driver_performance"},
```

An example of filtering feature-views with the tag `team:driver_performance`:
```commandline
$ feast feature-views list --tags team:driver_performance
NAME ENTITIES TYPE
driver_hourly_stats {'driver'} FeatureView
driver_hourly_stats_fresh {'driver'} FeatureView
```

The same example of listing feature-views without tag filtering:
```commandline
$ feast feature-views list
NAME ENTITIES TYPE
driver_hourly_stats {'driver'} FeatureView
driver_hourly_stats_fresh {'driver'} FeatureView
transformed_conv_rate_fresh {'driver'} OnDemandFeatureView
transformed_conv_rate {'driver'} OnDemandFeatureView
```

0 comments on commit 1b92803

Please sign in to comment.