29
29
from feast .infra .infra_object import SQLITE_INFRA_OBJECT_CLASS_TYPE , InfraObject
30
30
from feast .infra .key_encoding_utils import serialize_entity_key
31
31
from feast .infra .online_stores .online_store import OnlineStore
32
+ from feast .infra .online_stores .vector_store import VectorStoreConfig
32
33
from feast .protos .feast .core .InfraObject_pb2 import InfraObject as InfraObjectProto
33
34
from feast .protos .feast .core .Registry_pb2 import Registry as RegistryProto
34
35
from feast .protos .feast .core .SqliteTable_pb2 import SqliteTable as SqliteTableProto
38
39
from feast .utils import _build_retrieve_online_document_record , to_naive_utc
39
40
40
41
41
- class SqliteOnlineStoreConfig (FeastConfigBaseModel ):
42
+ class SqliteOnlineStoreConfig (FeastConfigBaseModel , VectorStoreConfig ):
42
43
"""Online store config for local (SQLite-based) store"""
43
44
44
45
type : Literal ["sqlite" , "feast.infra.online_stores.sqlite.SqliteOnlineStore" ] = (
@@ -49,12 +50,6 @@ class SqliteOnlineStoreConfig(FeastConfigBaseModel):
49
50
path : StrictStr = "data/online.db"
50
51
""" (optional) Path to sqlite db """
51
52
52
- vec_enabled : Optional [bool ] = False
53
- """ (optional) Enable or disable sqlite-vss for vector search"""
54
-
55
- vector_len : Optional [int ] = 512
56
- """ (optional) Length of the vector to be stored in the database"""
57
-
58
53
59
54
class SqliteOnlineStore (OnlineStore ):
60
55
"""
@@ -83,7 +78,7 @@ def _get_conn(self, config: RepoConfig):
83
78
if not self ._conn :
84
79
db_path = self ._get_db_path (config )
85
80
self ._conn = _initialize_conn (db_path )
86
- if sys .version_info [0 :2 ] == (3 , 10 ) and config .online_store .vec_enabled :
81
+ if sys .version_info [0 :2 ] == (3 , 10 ) and config .online_store .vector_enabled :
87
82
import sqlite_vec # noqa: F401
88
83
89
84
self ._conn .enable_load_extension (True ) # type: ignore
@@ -121,7 +116,7 @@ def online_write_batch(
121
116
122
117
table_name = _table_id (project , table )
123
118
for feature_name , val in values .items ():
124
- if config .online_store .vec_enabled :
119
+ if config .online_store .vector_enabled :
125
120
vector_bin = serialize_f32 (
126
121
val .float_list_val .val , config .online_store .vector_len
127
122
) # type: ignore
@@ -321,7 +316,7 @@ def retrieve_online_documents(
321
316
"""
322
317
project = config .project
323
318
324
- if not config .online_store .vec_enabled :
319
+ if not config .online_store .vector_enabled :
325
320
raise ValueError ("sqlite-vss is not enabled in the online store config" )
326
321
327
322
conn = self ._get_conn (config )
0 commit comments