Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Snowflake_online_read fix #2988

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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