File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
feast/infra/registry_stores Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -688,15 +688,16 @@ def _apply_object(
688688 self ,
689689 table : Table ,
690690 project : str ,
691- id_field_name ,
692- obj ,
693- proto_field_name ,
694- name = None ,
691+ id_field_name : str ,
692+ obj : Any ,
693+ proto_field_name : str ,
694+ name : Optional [ str ] = None ,
695695 ):
696696 self ._maybe_init_project_metadata (project )
697697
698698 name = name or obj .name if hasattr (obj , "name" ) else None
699699 assert name , f"name needs to be provided for { obj } "
700+
700701 with self .engine .connect () as conn :
701702 update_datetime = datetime .utcnow ()
702703 update_time = int (update_datetime .timestamp ())
@@ -721,9 +722,16 @@ def _apply_object(
721722 )
722723 conn .execute (update_stmt )
723724 else :
725+ obj_proto = obj .to_proto ()
726+
727+ if hasattr (obj_proto , "meta" ) and hasattr (
728+ obj_proto .meta , "created_timestamp"
729+ ):
730+ obj_proto .meta .created_timestamp .FromDatetime (update_datetime )
731+
724732 values = {
725733 id_field_name : name ,
726- proto_field_name : obj . to_proto () .SerializeToString (),
734+ proto_field_name : obj_proto .SerializeToString (),
727735 "last_updated_timestamp" : update_time ,
728736 "project_id" : project ,
729737 }
Original file line number Diff line number Diff line change @@ -167,6 +167,9 @@ def test_apply_entity_success(sql_registry):
167167 and entity .tags ["team" ] == "matchmaking"
168168 )
169169
170+ # After the first apply, the created_timestamp should be the same as the last_update_timestamp.
171+ assert entity .created_timestamp == entity .last_updated_timestamp
172+
170173 sql_registry .delete_entity ("driver_car_id" , project )
171174 assert_project_uuid (project , project_uuid , sql_registry )
172175 entities = sql_registry .list_entities (project )
@@ -255,6 +258,9 @@ def test_apply_feature_view_success(sql_registry):
255258 and feature_view .entities [0 ] == "fs1_my_entity_1"
256259 )
257260
261+ # After the first apply, the created_timestamp should be the same as the last_update_timestamp.
262+ assert feature_view .created_timestamp == feature_view .last_updated_timestamp
263+
258264 sql_registry .delete_feature_view ("my_feature_view_1" , project )
259265 feature_views = sql_registry .list_feature_views (project )
260266 assert len (feature_views ) == 0
You can’t perform that action at this time.
0 commit comments