Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Filter subset features
Signed-off-by: NHUAN.TRAN <NhuanTDBK@users.noreply.github.com>
  • Loading branch information
NHUAN.TRAN authored and NhuanTDBK committed Sep 10, 2022
commit e4b892d10ae2ecbb7f08d9652927db513075969e
32 changes: 21 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,27 @@ 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