Skip to content

Commit

Permalink
feat: Filter subset features in postgres feast-dev#3174 (feast-dev#3203)
Browse files Browse the repository at this point in the history
* Filter subset features

Signed-off-by: NHUAN.TRAN <[email protected]>
Signed-off-by: NHUAN.TRAN <[email protected]>

* Fix python lint

Signed-off-by: NHUAN.TRAN <[email protected]>

Signed-off-by: NHUAN.TRAN <[email protected]>
Signed-off-by: NHUAN.TRAN <[email protected]>
Co-authored-by: NHUAN.TRAN <[email protected]>
  • Loading branch information
NhuanTDBK and NHUAN.TRAN authored Sep 22, 2022
1 parent cb8db84 commit b48d36b
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions sdk/python/feast/infra/online_stores/contrib/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,30 @@ def online_read(
)
)

cur.execute(
sql.SQL(
"""
SELECT entity_key, feature_name, value, event_ts
FROM {} WHERE entity_key = ANY(%s);
"""
).format(
sql.Identifier(_table_id(project, table)),
),
(keys,),
)
if not requested_features:
cur.execute(
sql.SQL(
"""
SELECT entity_key, feature_name, value, event_ts
FROM {} WHERE entity_key = ANY(%s);
"""
).format(
sql.Identifier(_table_id(project, table)),
),
(keys,),
)
else:
cur.execute(
sql.SQL(
"""
SELECT entity_key, feature_name, value, event_ts
FROM {} WHERE entity_key = ANY(%s) and feature_name = ANY(%s);
"""
).format(
sql.Identifier(_table_id(project, table)),
),
(keys, requested_features),
)

rows = cur.fetchall()

Expand Down

0 comments on commit b48d36b

Please sign in to comment.