50
50
51
51
class FeatureView (BaseFeatureView ):
52
52
"""
53
- A FeatureView defines a logical grouping of serveable features.
53
+ A FeatureView defines a logical group of features.
54
54
55
- Args :
56
- name: Name of the group of features .
57
- entities: The entities to which this group of features is associated.
55
+ Attributes :
56
+ name: The unique name of the feature view .
57
+ entities: The list of entities with which this group of features is associated.
58
58
ttl: The amount of time this group of features lives. A ttl of 0 indicates that
59
59
this group of features lives forever. Note that large ttl's or a ttl of 0
60
60
can result in extremely computationally intensive queries.
61
61
batch_source: The batch source of data where this group of features is stored.
62
62
stream_source (optional): The stream source of data where this group of features
63
63
is stored.
64
- features (optional): The set of features defined as part of this FeatureView.
65
- tags (optional): A dictionary of key-value pairs used for organizing
66
- FeatureViews.
64
+ features: The list of features defined as part of this feature view.
65
+ online: A boolean indicating whether online retrieval is enabled for this feature
66
+ view.
67
+ description: A human-readable description.
68
+ tags: A dictionary of key-value pairs to store arbitrary metadata.
69
+ owner: The owner of the feature view, typically the email of the primary
70
+ maintainer.
67
71
"""
68
72
73
+ name : str
69
74
entities : List [str ]
70
- tags : Optional [Dict [str , str ]]
71
75
ttl : timedelta
72
- online : bool
73
76
batch_source : DataSource
74
77
stream_source : Optional [DataSource ]
78
+ features : List [Feature ]
79
+ online : bool
80
+ description : str
81
+ tags : Dict [str , str ]
82
+ owner : str
75
83
materialization_intervals : List [Tuple [datetime , datetime ]]
76
84
77
85
@log_exceptions
@@ -83,12 +91,31 @@ def __init__(
83
91
batch_source : DataSource ,
84
92
stream_source : Optional [DataSource ] = None ,
85
93
features : Optional [List [Feature ]] = None ,
86
- tags : Optional [Dict [str , str ]] = None ,
87
94
online : bool = True ,
95
+ description : str = "" ,
96
+ tags : Optional [Dict [str , str ]] = None ,
97
+ owner : str = "" ,
88
98
):
89
99
"""
90
100
Creates a FeatureView object.
91
101
102
+ Args:
103
+ name: The unique name of the feature view.
104
+ entities: The list of entities with which this group of features is associated.
105
+ ttl: The amount of time this group of features lives. A ttl of 0 indicates that
106
+ this group of features lives forever. Note that large ttl's or a ttl of 0
107
+ can result in extremely computationally intensive queries.
108
+ batch_source: The batch source of data where this group of features is stored.
109
+ stream_source (optional): The stream source of data where this group of features
110
+ is stored.
111
+ features (optional): The list of features defined as part of this feature view.
112
+ online (optional): A boolean indicating whether online retrieval is enabled for
113
+ this feature view.
114
+ description (optional): A human-readable description.
115
+ tags (optional): A dictionary of key-value pairs to store arbitrary metadata.
116
+ owner (optional): The owner of the feature view, typically the email of the
117
+ primary maintainer.
118
+
92
119
Raises:
93
120
ValueError: A field mapping conflicts with an Entity or a Feature.
94
121
"""
@@ -106,9 +133,8 @@ def __init__(
106
133
f"Entity or Feature name."
107
134
)
108
135
109
- super ().__init__ (name , _features )
136
+ super ().__init__ (name , _features , description , tags , owner )
110
137
self .entities = entities if entities else [DUMMY_ENTITY_NAME ]
111
- self .tags = tags if tags is not None else {}
112
138
113
139
if isinstance (ttl , Duration ):
114
140
self .ttl = timedelta (seconds = int (ttl .seconds ))
@@ -123,10 +149,9 @@ def __init__(
123
149
else :
124
150
self .ttl = ttl
125
151
126
- self .online = online
127
152
self .batch_source = batch_source
128
153
self .stream_source = stream_source
129
-
154
+ self . online = online
130
155
self .materialization_intervals = []
131
156
132
157
# Note: Python requires redefining hash in child classes that override __eq__
@@ -312,7 +337,9 @@ def to_proto(self) -> FeatureViewProto:
312
337
name = self .name ,
313
338
entities = self .entities ,
314
339
features = [feature .to_proto () for feature in self .features ],
340
+ description = self .description ,
315
341
tags = self .tags ,
342
+ owner = self .owner ,
316
343
ttl = (ttl_duration if ttl_duration is not None else None ),
317
344
online = self .online ,
318
345
batch_source = batch_source_proto ,
@@ -349,7 +376,9 @@ def from_proto(cls, feature_view_proto: FeatureViewProto):
349
376
)
350
377
for feature in feature_view_proto .spec .features
351
378
],
379
+ description = feature_view_proto .spec .description ,
352
380
tags = dict (feature_view_proto .spec .tags ),
381
+ owner = feature_view_proto .spec .owner ,
353
382
online = feature_view_proto .spec .online ,
354
383
ttl = (
355
384
None
0 commit comments