Skip to content
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
5 changes: 5 additions & 0 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,15 @@ def __init__(self, **data: Any):
self.online_store = get_online_config_from_type(self.online_store["type"])(
**self.online_store
)
elif isinstance(self.online_store, str):
self.online_store = get_online_config_from_type(self.online_store)()

if isinstance(self.offline_store, Dict):
self.offline_store = get_offline_config_from_type(
self.offline_store["type"]
)(**self.offline_store)
elif isinstance(self.offline_store, str):
self.offline_store = get_offline_config_from_type(self.offline_store)()

def get_registry_config(self):
if isinstance(self.registry, str):
Expand Down
24 changes: 22 additions & 2 deletions sdk/python/tests/test_repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from textwrap import dedent
from typing import Optional

from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig
from feast.repo_config import FeastConfigError, load_repo_config


Expand All @@ -18,8 +19,9 @@ def _test_config(config_text, expect_error: Optional[str]):

repo_config.write_text(config_text)
error = None
rc = None
try:
load_repo_config(repo_path)
rc = load_repo_config(repo_path)
except FeastConfigError as e:
error = e

Expand All @@ -29,6 +31,8 @@ def _test_config(config_text, expect_error: Optional[str]):
print(f"error: {error}")
assert error is None

return rc


def test_local_config():
_test_config(
Expand All @@ -44,7 +48,7 @@ def test_local_config():


def test_local_config_with_full_online_class():
_test_config(
c = _test_config(
dedent(
"""
project: foo
Expand All @@ -56,6 +60,22 @@ def test_local_config_with_full_online_class():
),
expect_error=None,
)
assert isinstance(c.online_store, SqliteOnlineStoreConfig)


def test_local_config_with_full_online_class_directly():
c = _test_config(
dedent(
"""
project: foo
registry: "registry.db"
provider: local
online_store: feast.infra.online_stores.sqlite.SqliteOnlineStore
"""
),
expect_error=None,
)
assert isinstance(c.online_store, SqliteOnlineStoreConfig)


def test_gcp_config():
Expand Down