Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix to update feast object metadata in the sql registry
Signed-off-by: msistla96 <msistla@expediagroup.com>
  • Loading branch information
msistla96 committed Jun 9, 2024
commit 04b9867f8bab3a270858c46af67cfd99e9247a9d
626 changes: 626 additions & 0 deletions Created_timestamp_fix.patch

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions sdk/python/feast/base_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,6 @@ def with_projection(self, feature_view_projection: FeatureViewProjection):
cp.projection = feature_view_projection

return cp

def update_meta(self, serialized_proto: bytes):
pass
4 changes: 4 additions & 0 deletions sdk/python/feast/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ def from_proto(cls, entity_proto: EntityProto):

return entity

def update_meta(self, stored_proto: bytes):
entity_proto = EntityProto.FromString(stored_proto)
self.created_timestamp = entity_proto.meta.created_timestamp.ToDatetime()

def to_proto(self) -> EntityProto:
"""
Converts an entity object to its protobuf representation.
Expand Down
6 changes: 6 additions & 0 deletions sdk/python/feast/feature_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ def from_proto(cls, feature_service_proto: FeatureServiceProto):

return fs

def update_meta(self, stored_proto: bytes):
feature_service_proto = FeatureServiceProto.FromString(stored_proto)
self.created_timestamp = (
feature_service_proto.meta.created_timestamp.ToDatetime()
)

def to_proto(self) -> FeatureServiceProto:
"""
Converts a feature service to its protobuf representation.
Expand Down
9 changes: 9 additions & 0 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,15 @@ def with_join_key_map(self, join_key_map: Dict[str, str]):

return cp

def update_meta(self, stored_proto: bytes):
feature_view_proto = FeatureViewProto.FromString(stored_proto)
self.created_timestamp = feature_view_proto.meta.created_timestamp.ToDatetime()

for interval in feature_view_proto.meta.materialization_intervals:
self.materialization_intervals.append(
(interval.start_time.ToDatetime(), interval.end_time.ToDatetime())
)

def to_proto(self) -> FeatureViewProto:
"""
Converts a feature view object to its protobuf representation.
Expand Down
7 changes: 7 additions & 0 deletions sdk/python/feast/infra/registry/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,13 @@ def _apply_object(
obj.last_updated_timestamp = update_datetime

if row:
if proto_field_name in [
"entity_proto",
"saved_dataset_proto",
"feature_view_proto",
"feature_service_proto",
]:
obj.update_meta(row._mapping[proto_field_name])
values = {
proto_field_name: obj.to_proto().SerializeToString(),
"last_updated_timestamp": update_time,
Expand Down
6 changes: 6 additions & 0 deletions sdk/python/feast/on_demand_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def __eq__(self, other):
def __hash__(self):
return super().__hash__()

def update_meta(self, stored_proto: bytes):
on_demand_feature_view_proto = OnDemandFeatureViewProto.FromString(stored_proto)
self.created_timestamp = (
on_demand_feature_view_proto.meta.created_timestamp.ToDatetime()
)

def to_proto(self) -> OnDemandFeatureViewProto:
"""
Converts an on demand feature view object to its protobuf representation.
Expand Down
10 changes: 10 additions & 0 deletions sdk/python/feast/saved_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ def __eq__(self, other):

return True

def update_meta(self, stored_proto: bytes):
saved_dataset_proto = SavedDatasetProto.FromString(stored_proto)
self.created_timestamp = saved_dataset_proto.meta.created_timestamp.ToDatetime()
self.min_event_timestamp = (
saved_dataset_proto.meta.min_event_timestamp.ToDatetime()
)
self.max_event_timestamp = (
saved_dataset_proto.meta.max_event_timestamp.ToDatetime()
)

@staticmethod
def from_proto(saved_dataset_proto: SavedDatasetProto):
"""
Expand Down
14 changes: 14 additions & 0 deletions sdk/python/feast/stream_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ def __eq__(self, other):
def __hash__(self) -> int:
return super().__hash__()

def update_meta(self, stored_proto: bytes):
stream_feature_view_proto = StreamFeatureViewProto.FromString(stored_proto)
self.created_timestamp = (
stream_feature_view_proto.meta.created_timestamp.ToDatetime()
)

for interval in stream_feature_view_proto.meta.materialization_intervals:
self.materialization_intervals.append(
(
interval.start_time.ToDatetime(),
interval.end_time.ToDatetime(),
)
)

def to_proto(self):
meta = self.to_proto_meta()
ttl_duration = self.get_ttl_duration()
Expand Down
Loading