From 1b9280302b525084d7e1d4f99b2a8fcd68361a99 Mon Sep 17 00:00:00 2001 From: Theodor Mihalache <84387487+tmihalac@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:24:56 -0400 Subject: [PATCH] docs: Add docs example of how to use tags with feature views (#4536) * Add docs example of how to use tags with feature views Signed-off-by: Theodor Mihalache * Add docs example of how to use tags with feature views - changes following review Signed-off-by: Theodor Mihalache --------- Signed-off-by: Theodor Mihalache --- docs/getting-started/concepts/README.md | 4 ++ docs/getting-started/concepts/tags.md | 59 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 docs/getting-started/concepts/tags.md diff --git a/docs/getting-started/concepts/README.md b/docs/getting-started/concepts/README.md index 9b967fb5af..a32c53b5f4 100644 --- a/docs/getting-started/concepts/README.md +++ b/docs/getting-started/concepts/README.md @@ -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 %} diff --git a/docs/getting-started/concepts/tags.md b/docs/getting-started/concepts/tags.md new file mode 100644 index 0000000000..d5b285f7c7 --- /dev/null +++ b/docs/getting-started/concepts/tags.md @@ -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 +``` +