Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit ad3ea8d

Browse files
amommendesadchiaachals
authored
Add created timestamp for feature views (feast-dev#1952)
* Updating roadmap + hero image (feast-dev#1950) * Update hero image Signed-off-by: Danny Chiao <[email protected]> * Fix roadmap extra line Signed-off-by: Danny Chiao <[email protected]> Signed-off-by: Amom Mendes <[email protected]> * ✨ Add created timestamp for feature view Signed-off-by: Amom Mendes <[email protected]> * 🎨 Adding created timestamp to base feature view and on demand feature view Signed-off-by: Amom Mendes <[email protected]> * 🚨 Fix import Signed-off-by: Amom Mendes <[email protected]> * 🔥 Remove unused import Signed-off-by: Amom Mendes <[email protected]> * 🎨 Add read/write created timestamp to ODFV Signed-off-by: Amom Mendes <[email protected]> * 🚨 Fix isort lint Signed-off-by: Amom Mendes <[email protected]> Co-authored-by: Danny Chiao <[email protected]> Co-authored-by: Achal Shah <[email protected]>
1 parent 6c09bc4 commit ad3ea8d

File tree

7 files changed

+26
-3
lines changed

7 files changed

+26
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ The list below contains the functionality that contributors are planning to deve
134134
* We welcome contribution to all items in the roadmap!
135135
* Want to influence our roadmap and prioritization? Submit your feedback to [this form](https://docs.google.com/forms/d/e/1FAIpQLSfa1nRQ0sKz-JEFnMMCi4Jseag\_yDssO\_3nV9qMfxfrkil-wA/viewform).
136136
* Want to speak to a Feast contributor? We are more than happy to jump on a call. Please schedule a time using [Calendly](https://calendly.com/d/x2ry-g5bb/meet-with-feast-team).
137+
137138
* **Data Sources**
138139
* [x] [Redshift source](https://docs.feast.dev/reference/data-sources/redshift)
139140
* [x] [BigQuery source](https://docs.feast.dev/reference/data-sources/bigquery)

docs/roadmap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The list below contains the functionality that contributors are planning to deve
66
* We welcome contribution to all items in the roadmap!
77
* Want to influence our roadmap and prioritization? Submit your feedback to [this form](https://docs.google.com/forms/d/e/1FAIpQLSfa1nRQ0sKz-JEFnMMCi4Jseag\_yDssO\_3nV9qMfxfrkil-wA/viewform).
88
* Want to speak to a Feast contributor? We are more than happy to jump on a call. Please schedule a time using [Calendly](https://calendly.com/d/x2ry-g5bb/meet-with-feast-team).
9+
910
* **Data Sources**
1011
* [x] [Redshift source](https://docs.feast.dev/reference/data-sources/redshift)
1112
* [x] [BigQuery source](https://docs.feast.dev/reference/data-sources/bigquery)

protos/feast/core/OnDemandFeatureView.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ option go_package = "github.com/feast-dev/feast/sdk/go/protos/feast/core";
2222
option java_outer_classname = "OnDemandFeatureViewProto";
2323
option java_package = "feast.proto.core";
2424

25+
import "google/protobuf/timestamp.proto";
2526
import "feast/core/FeatureView.proto";
2627
import "feast/core/Feature.proto";
2728
import "feast/core/DataSource.proto";
2829

2930
message OnDemandFeatureView {
3031
// User-specified specifications of this feature view.
3132
OnDemandFeatureViewSpec spec = 1;
33+
OnDemandFeatureViewMeta meta = 2;
3234
}
3335

3436
message OnDemandFeatureViewSpec {
@@ -45,6 +47,13 @@ message OnDemandFeatureViewSpec {
4547
map<string, OnDemandInput> inputs = 4;
4648

4749
UserDefinedFunction user_defined_function = 5;
50+
51+
52+
}
53+
54+
message OnDemandFeatureViewMeta {
55+
// Time where this Feature View is created
56+
google.protobuf.Timestamp created_timestamp = 1;
4857
}
4958

5059
message OnDemandInput {

sdk/python/feast/base_feature_view.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# limitations under the License.
1414
import warnings
1515
from abc import ABC, abstractmethod
16-
from typing import List, Type
16+
from datetime import datetime
17+
from typing import List, Optional, Type
1718

1819
from google.protobuf.json_format import MessageToJson
1920
from proto import Message
@@ -32,6 +33,7 @@ def __init__(self, name: str, features: List[Feature]):
3233
self._name = name
3334
self._features = features
3435
self._projection = FeatureViewProjection.from_definition(self)
36+
self.created_timestamp: Optional[datetime] = None
3537

3638
@property
3739
def name(self) -> str:

sdk/python/feast/feature_view.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class FeatureView(BaseFeatureView):
7575
input: DataSource
7676
batch_source: DataSource
7777
stream_source: Optional[DataSource] = None
78-
created_timestamp: Optional[datetime] = None
7978
last_updated_timestamp: Optional[datetime] = None
8079
materialization_intervals: List[Tuple[datetime, datetime]]
8180

sdk/python/feast/on_demand_feature_view.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
OnDemandFeatureView as OnDemandFeatureViewProto,
1818
)
1919
from feast.protos.feast.core.OnDemandFeatureView_pb2 import (
20+
OnDemandFeatureViewMeta,
2021
OnDemandFeatureViewSpec,
2122
OnDemandInput,
2223
)
@@ -90,6 +91,9 @@ def to_proto(self) -> OnDemandFeatureViewProto:
9091
Returns:
9192
A OnDemandFeatureViewProto protobuf.
9293
"""
94+
meta = OnDemandFeatureViewMeta()
95+
if self.created_timestamp:
96+
meta.created_timestamp.FromDatetime(self.created_timestamp)
9397
inputs = {}
9498
for input_ref, fv in self.input_feature_views.items():
9599
inputs[input_ref] = OnDemandInput(feature_view=fv.to_proto())
@@ -107,7 +111,7 @@ def to_proto(self) -> OnDemandFeatureViewProto:
107111
),
108112
)
109113

110-
return OnDemandFeatureViewProto(spec=spec)
114+
return OnDemandFeatureViewProto(spec=spec, meta=meta)
111115

112116
@classmethod
113117
def from_proto(cls, on_demand_feature_view_proto: OnDemandFeatureViewProto):
@@ -155,6 +159,11 @@ def from_proto(cls, on_demand_feature_view_proto: OnDemandFeatureViewProto):
155159
on_demand_feature_view_obj
156160
)
157161

162+
if on_demand_feature_view_proto.meta.HasField("created_timestamp"):
163+
on_demand_feature_view_obj.created_timestamp = (
164+
on_demand_feature_view_proto.meta.created_timestamp.ToDatetime()
165+
)
166+
158167
return on_demand_feature_view_obj
159168

160169
def get_request_data_schema(self) -> Dict[str, ValueType]:

sdk/python/feast/registry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ def apply_feature_view(
405405
commit: Whether the change should be persisted immediately
406406
"""
407407
feature_view.ensure_valid()
408+
if not feature_view.created_timestamp:
409+
feature_view.created_timestamp = datetime.now()
408410
feature_view_proto = feature_view.to_proto()
409411
feature_view_proto.spec.project = project
410412
self._prepare_registry_for_changes()

0 commit comments

Comments
 (0)