Skip to content

Commit

Permalink
fix: Snowflake_online_read fix (#2988)
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Adkins <miles.adkins@snowflake.com>
  • Loading branch information
sfc-gh-madkins authored Aug 1, 2022
1 parent 5358f0d commit 651ce34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions sdk/python/feast/infra/online_stores/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ def online_write_batch(
for j, (feature_name, val) in enumerate(values.items()):
df.loc[j, "entity_feature_key"] = serialize_entity_key(
entity_key,
entity_key_serialization_version=entity_key_serialization_version,
entity_key_serialization_version,
) + bytes(feature_name, encoding="utf-8")
df.loc[j, "entity_key"] = serialize_entity_key(
entity_key,
entity_key_serialization_version=entity_key_serialization_version,
entity_key_serialization_version,
)
df.loc[j, "feature_name"] = feature_name
df.loc[j, "value"] = val.SerializeToString()
Expand Down Expand Up @@ -156,12 +156,18 @@ def online_read(

result: List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]] = []

entity_key_serialization_version = (
config.entity_key_serialization_version
if config.entity_key_serialization_version
else 2
)

entity_fetch_str = ",".join(
[
(
"TO_BINARY("
+ hexlify(
serialize_entity_key(combo[0])
serialize_entity_key(combo[0], entity_key_serialization_version)
+ bytes(combo[1], encoding="utf-8")
).__str__()[1:]
+ ")"
Expand All @@ -187,15 +193,10 @@ def online_read(
.fetch_pandas_all()
)

entity_key_serialization_version = (
config.entity_key_serialization_version
if config.entity_key_serialization_version
else 2
)
for entity_key in entity_keys:
entity_key_bin = serialize_entity_key(
entity_key,
entity_key_serialization_version=entity_key_serialization_version,
entity_key_serialization_version,
)
res = {}
res_ts = None
Expand Down
1 change: 1 addition & 0 deletions sdk/python/feast/templates/snowflake/feature_store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ offline_store:
role: SNOWFLAKE_ROLE
warehouse: SNOWFLAKE_WAREHOUSE
database: SNOWFLAKE_DATABASE
entity_key_serialization_version: 2
online_store:
type: snowflake.online
account: SNOWFLAKE_DEPLOYMENT_URL
Expand Down

0 comments on commit 651ce34

Please sign in to comment.