Skip to content

Commit 2568a9e

Browse files
updated
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent da6c00e commit 2568a9e

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

  • sdk/python/feast/infra/online_stores

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,16 @@ class SqliteOnlineStore(OnlineStore):
108108

109109
@staticmethod
110110
def _get_db_path(config: RepoConfig) -> str:
111-
online_store = config.online_store
112-
if not isinstance(online_store, SqliteOnlineStoreConfig):
113-
raise ValueError("online_store must be SqliteOnlineStoreConfig")
114-
if config.repo_path and not Path(online_store.path).is_absolute():
115-
return str(config.repo_path / online_store.path)
116-
return str(online_store.path)
111+
assert (
112+
config.online_store.type == "sqlite"
113+
or config.online_store.type.endswith("SqliteOnlineStore")
114+
)
115+
116+
if config.repo_path and not Path(config.online_store.path).is_absolute():
117+
db_path = str(config.repo_path / config.online_store.path)
118+
else:
119+
db_path = config.online_store.path
120+
return db_path
117121

118122
def _get_conn(self, config: RepoConfig):
119123
if not self._conn:
@@ -124,9 +128,10 @@ def _get_conn(self, config: RepoConfig):
124128
raise ValueError("online_store must be SqliteOnlineStoreConfig")
125129
if sys.version_info[0:2] == (3, 10) and online_store.vector_enabled:
126130
import sqlite_vec # noqa: F401
127-
128-
self._conn.enable_load_extension(True) # type: ignore
129-
sqlite_vec.load(self._conn)
131+
db = sqlite3.Connection(':memory:')
132+
db.enable_load_extension(True)
133+
sqlite_vec.load(db)
134+
return db
130135

131136
return self._conn
132137

@@ -588,11 +593,12 @@ def _initialize_conn(db_path: str):
588593
except ModuleNotFoundError:
589594
logging.warning("Cannot use sqlite_vec for vector search")
590595
Path(db_path).parent.mkdir(exist_ok=True)
591-
return sqlite3.connect(
596+
db = sqlite3.connect(
592597
db_path,
593598
detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES,
594599
check_same_thread=False,
595600
)
601+
return db
596602

597603

598604
def _table_id(project: str, table: FeatureView) -> str:

0 commit comments

Comments
 (0)