Commit 63d541d 1 parent 1996596 commit 63d541d Copy full SHA for 63d541d
File tree 2 files changed +19
-5
lines changed
feast/infra/registry_stores
2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -688,15 +688,16 @@ def _apply_object(
688
688
self ,
689
689
table : Table ,
690
690
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 ,
695
695
):
696
696
self ._maybe_init_project_metadata (project )
697
697
698
698
name = name or obj .name if hasattr (obj , "name" ) else None
699
699
assert name , f"name needs to be provided for { obj } "
700
+
700
701
with self .engine .connect () as conn :
701
702
update_datetime = datetime .utcnow ()
702
703
update_time = int (update_datetime .timestamp ())
@@ -721,9 +722,16 @@ def _apply_object(
721
722
)
722
723
conn .execute (update_stmt )
723
724
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
+
724
732
values = {
725
733
id_field_name : name ,
726
- proto_field_name : obj . to_proto () .SerializeToString (),
734
+ proto_field_name : obj_proto .SerializeToString (),
727
735
"last_updated_timestamp" : update_time ,
728
736
"project_id" : project ,
729
737
}
Original file line number Diff line number Diff line change @@ -168,6 +168,9 @@ def test_apply_entity_success(sql_registry):
168
168
and entity .tags ["team" ] == "matchmaking"
169
169
)
170
170
171
+ # After the first apply, the created_timestamp should be the same as the last_update_timestamp.
172
+ assert entity .created_timestamp == entity .last_updated_timestamp
173
+
171
174
sql_registry .delete_entity ("driver_car_id" , project )
172
175
assert_project_uuid (project , project_uuid , sql_registry )
173
176
entities = sql_registry .list_entities (project )
@@ -256,6 +259,9 @@ def test_apply_feature_view_success(sql_registry):
256
259
and feature_view .entities [0 ] == "fs1_my_entity_1"
257
260
)
258
261
262
+ # After the first apply, the created_timestamp should be the same as the last_update_timestamp.
263
+ assert feature_view .created_timestamp == feature_view .last_updated_timestamp
264
+
259
265
sql_registry .delete_feature_view ("my_feature_view_1" , project )
260
266
feature_views = sql_registry .list_feature_views (project )
261
267
assert len (feature_views ) == 0
You can’t perform that action at this time.
0 commit comments