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

adding online store for Milvus #11

Merged
merged 6 commits into from
Aug 2, 2023
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
73 changes: 73 additions & 0 deletions sdk/python/feast/expediagroup/vectordb/milvus_online_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple

from pydantic.typing import Literal

from feast import Entity, RepoConfig
from feast.expediagroup.vectordb.vector_feature_view import VectorFeatureView
from feast.expediagroup.vectordb.vector_online_store import VectorOnlineStore
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
from feast.repo_config import FeastConfigBaseModel


class MilvusOnlineStoreConfig(FeastConfigBaseModel):
"""Online store config for the Milvus online store"""

type: Literal["milvus"] = "milvus"
"""Online store type selector"""

host: str
""" the host URL """

port: int = 19530
""" the port to connect to a Milvus instance. Should be the one used for GRPC (default: 19530) """


class MilvusOnlineStore(VectorOnlineStore):
def online_write_batch(
self,
config: RepoConfig,
table: VectorFeatureView,
data: List[
Tuple[EntityKeyProto, Dict[str, ValueProto], datetime, Optional[datetime]]
],
progress: Optional[Callable[[int], Any]],
) -> None:
raise NotImplementedError(
"to be implemented in https://jira.expedia.biz/browse/EAPC-7971"
)

def online_read(
self,
config: RepoConfig,
table: VectorFeatureView,
entity_keys: List[EntityKeyProto],
requested_features: Optional[List[str]] = None,
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
raise NotImplementedError(
"to be implemented in https://jira.expedia.biz/browse/EAPC-7972"
)

def update(
self,
config: RepoConfig,
tables_to_delete: Sequence[VectorFeatureView],
tables_to_keep: Sequence[VectorFeatureView],
entities_to_delete: Sequence[Entity],
entities_to_keep: Sequence[Entity],
partial: bool,
):
raise NotImplementedError(
"to be implemented in https://jira.expedia.biz/browse/EAPC-7970"
)

def teardown(
self,
config: RepoConfig,
tables: Sequence[VectorFeatureView],
entities: Sequence[Entity],
):
raise NotImplementedError(
"to be implemented in https://jira.expedia.biz/browse/EAPC-7974"
)
63 changes: 63 additions & 0 deletions sdk/python/feast/expediagroup/vectordb/vector_online_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from abc import abstractmethod
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple

from feast import Entity, RepoConfig
from feast.expediagroup.vectordb.vector_feature_view import VectorFeatureView
from feast.infra.online_stores.online_store import OnlineStore
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto


class VectorOnlineStore(OnlineStore):
"""
Abstraction for vector database implementations of the online store interface. Any online store implementation of
a vector database should inherit this class.
"""

@abstractmethod
def online_write_batch(
self,
config: RepoConfig,
table: VectorFeatureView,
data: List[
Tuple[EntityKeyProto, Dict[str, ValueProto], datetime, Optional[datetime]]
],
progress: Optional[Callable[[int], Any]],
) -> None:
# to be implemented in inheriting class
pass

@abstractmethod
def online_read(
self,
config: RepoConfig,
table: VectorFeatureView,
entity_keys: List[EntityKeyProto],
requested_features: Optional[List[str]] = None,
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
# to be implemented in inheriting class
pass

@abstractmethod
def update(
self,
config: RepoConfig,
tables_to_delete: Sequence[VectorFeatureView],
tables_to_keep: Sequence[VectorFeatureView],
entities_to_delete: Sequence[Entity],
entities_to_keep: Sequence[Entity],
partial: bool,
):
# to be implemented in inheriting class
pass

@abstractmethod
def teardown(
self,
config: RepoConfig,
tables: Sequence[VectorFeatureView],
entities: Sequence[Entity],
):
# to be implemented in inheriting class
pass
1 change: 1 addition & 0 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"mysql": "feast.infra.online_stores.contrib.mysql_online_store.mysql.MySQLOnlineStore",
"rockset": "feast.infra.online_stores.contrib.rockset_online_store.rockset.RocksetOnlineStore",
"hazelcast": "feast.infra.online_stores.contrib.hazelcast_online_store.hazelcast_online_store.HazelcastOnlineStore",
"milvus": "feast.expediagroup.vectordb.milvus_online_store.MilvusOnlineStore",
}

OFFLINE_STORE_CLASS_FOR_TYPE = {
Expand Down
Loading
Loading