Skip to content

Commit 7f8d7bb

Browse files
committed
created_timestamp
Signed-off-by: Achal Shah <[email protected]>
1 parent 6ab437d commit 7f8d7bb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎sdk/python/feast/infra/registry_stores/sql.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,16 @@ def _apply_object(
722722
)
723723
conn.execute(update_stmt)
724724
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+
725732
values = {
726733
id_field_name: name,
727-
proto_field_name: obj.to_proto().SerializeToString(),
734+
proto_field_name: obj_proto.SerializeToString(),
728735
"last_updated_timestamp": update_time,
729736
"project_id": project,
730737
}

‎sdk/python/tests/unit/test_sql_registry.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ def test_apply_entity_success(sql_registry):
168168
and entity.tags["team"] == "matchmaking"
169169
)
170170

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+
171174
sql_registry.delete_entity("driver_car_id", project)
172175
assert_project_uuid(project, project_uuid, sql_registry)
173176
entities = sql_registry.list_entities(project)
@@ -256,6 +259,9 @@ def test_apply_feature_view_success(sql_registry):
256259
and feature_view.entities[0] == "fs1_my_entity_1"
257260
)
258261

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+
259265
sql_registry.delete_feature_view("my_feature_view_1", project)
260266
feature_views = sql_registry.list_feature_views(project)
261267
assert len(feature_views) == 0

0 commit comments

Comments
 (0)