Skip to content

Commit 2cd73d1

Browse files
committed
feat: add document store
1 parent 58d5d94 commit 2cd73d1

2 files changed

Lines changed: 16 additions & 19 deletions

File tree

sdk/python/feast/infra/online_stores/contrib/postgres.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,16 @@ def online_search(
341341
return result
342342

343343
def create_index(
344-
self, config: RepoConfig, index: str, index_config: DocumentStoreIndexConfig
344+
self,
345+
config: RepoConfig,
346+
table: str
345347
):
348+
document_store_config = config.document_store_config
346349
with self._get_conn(config) as conn, conn.cursor() as cur:
347350
cur.execute(
348351
CREATE_INDEX_QUERY_TEMPLATE.format(
349-
table_name=config.project,
350-
index_type=index,
351-
embeding_type=index_config.embedding_type,
352+
table=table,
353+
index_type=document_store_config.index_type,
354+
embeding_type=document_store_config.embedding_type,
352355
)
353356
)

sdk/python/feast/infra/online_stores/document_store.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,23 @@
77
from feast.feature_view import FeatureView
88
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
99
from feast.repo_config import FeastConfigBaseModel, RepoConfig
10-
from infra.online_stores.online_store import OnlineStore
10+
from feast.infra.online_stores.online_store import OnlineStore
1111

1212

1313
class DocumentStoreIndexConfig(FeastConfigBaseModel):
14+
index_type: Optional[str]
1415
embedding_type: Optional[str]
1516

1617

1718
class DocumentStore(OnlineStore):
18-
index: Optional[str]
1919

2020
@abstractmethod
2121
def online_search(
22-
self,
23-
config: RepoConfig,
24-
table: FeatureView,
25-
requested_feature: str,
26-
embeddings: np.ndarray,
27-
top_k: int,
22+
self,
23+
config: RepoConfig,
24+
table: FeatureView,
25+
requested_feature: str,
26+
embeddings: np.ndarray,
27+
top_k: int,
2828
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
29-
raise NotImplementedError("You have to implement this!")
30-
31-
@abstractmethod
32-
def create_index(
33-
self, config: RepoConfig, index: str, index_config: DocumentStoreIndexConfig
34-
):
35-
raise NotImplementedError("You have to implement this!")
29+
raise NotImplementedError("You have to implement this!")

0 commit comments

Comments
 (0)