Skip to content

Commit

Permalink
Change GCP template names to match local template (#1470)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Klegar <jacob@tecton.ai>
  • Loading branch information
jklegar authored Apr 15, 2021
1 parent 790e76d commit 8d621d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions sdk/python/feast/templates/gcp/driver_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# construction of feature vectors
driver = Entity(
# Name of the entity. Must be unique within a project
name="driver",
name="driver_id",
# The join key of an entity describes the storage level field/column on which
# features can be looked up. The join key is also used to join feature
# tables/views when building feature vectors
Expand All @@ -20,7 +20,7 @@
# datasets or materializing features into an online store.
driver_stats_source = BigQuerySource(
# The BigQuery table where features can be found
table_ref="feast-oss.demo_data.driver_stats",
table_ref="feast-oss.demo_data.driver_hourly_stats",
# The event timestamp is used for point-in-time joins and for ensuring only
# features within the TTL are returned
event_timestamp_column="datetime",
Expand All @@ -34,11 +34,11 @@
driver_stats_fv = FeatureView(
# The unique name of this feature view. Two feature views in a single
# project cannot have the same name
name="driver_stats",
name="driver_hourly_stats",
# The list of entities specifies the keys required for joining or looking
# up features from this feature view. The reference provided in this field
# correspond to the name of a defined entity (or entities)
entities=["driver"],
entities=["driver_id"],
# The timedelta is the maximum age that each feature value may have
# relative to its lookup time. For historical features (used in training),
# TTL is relative to each timestamp provided in the entity dataframe.
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/feast/templates/gcp/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main():
fs.apply([driver, driver_stats_fv])

# Select features
feature_refs = ["driver_stats:conv_rate", "driver_stats:acc_rate"]
feature_refs = ["driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate"]

# Create an entity dataframe. This is the dataframe that will be enriched with historical features
entity_df = pd.DataFrame(
Expand All @@ -31,7 +31,7 @@ def main():
periods=3,
)
],
"driver_id": [5001, 5002, 5003],
"driver_id": [1001, 1002, 1003],
}
)

Expand All @@ -54,7 +54,8 @@ def main():

# Retrieve features from the online store (Firestore)
online_features = fs.get_online_features(
feature_refs=feature_refs, entity_rows=[{"driver": 5001}, {"driver": 5002}]
feature_refs=feature_refs,
entity_rows=[{"driver_id": 1001}, {"driver_id": 1002}],
).to_dict()

print()
Expand Down

0 comments on commit 8d621d4

Please sign in to comment.