Skip to content

Commit

Permalink
updating test
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Javier Arceo <[email protected]>
  • Loading branch information
franciscojavierarceo committed Sep 28, 2024
1 parent 77fa236 commit cc08644
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions sdk/python/tests/unit/test_on_demand_python_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,31 @@ def python_stored_writes_feature_view(

def test_stored_writes(self):
current_datetime = _utc_now()
entity_rows_to_write = [
fv_entity_rows_to_write = [
{
"driver_id": 1001,
"conv_rate": 0.25,
"acc_rate": 0.25,
"avg_daily_trips": 2,
"event_timestamp": current_datetime,
"created": current_datetime,
}
]
odfv_entity_rows_to_write = [
{
"driver_id": 1001,
"counter": 0,
"input_datetime": current_datetime,
}
]
fv_entity_rows_to_read = [
{
"driver_id": 1001,
}
]
# Note that here we shouldn't have to pass the request source features for reading
# because they should have already been written to the online store
entity_rows_to_read = [
odfv_entity_rows_to_read = [
{
"driver_id": 1001,
"conv_rate": 0.25,
Expand All @@ -647,14 +662,29 @@ def test_stored_writes(self):
"input_datetime": current_datetime,
}
]
print("storing fv features")
self.store.write_to_online_store(
feature_view_name="driver_hourly_stats",
df=fv_entity_rows_to_write,
)
print("reading fv features")
online_python_response = self.store.get_online_features(
entity_rows=fv_entity_rows_to_read,
features=[
"driver_hourly_stats:conv_rate",
"driver_hourly_stats:acc_rate",
"driver_hourly_stats:avg_daily_trips",
],
).to_dict()
print(online_python_response)
print("storing odfv features")
self.store.write_to_online_store(
feature_view_name="python_stored_writes_feature_view",
df=entity_rows_to_write,
df=odfv_entity_rows_to_write,
)
print("reading odfv features")
online_python_response = self.store.get_online_features(
entity_rows=entity_rows_to_read,
entity_rows=odfv_entity_rows_to_read,
features=[
"python_stored_writes_feature_view:conv_rate_plus_acc",
"python_stored_writes_feature_view:current_datetime",
Expand Down

0 comments on commit cc08644

Please sign in to comment.