diff --git a/sdk/python/feast/repo_config.py b/sdk/python/feast/repo_config.py index 968af8bc9eb..8ef98736f9a 100644 --- a/sdk/python/feast/repo_config.py +++ b/sdk/python/feast/repo_config.py @@ -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): diff --git a/sdk/python/tests/test_repo_config.py b/sdk/python/tests/test_repo_config.py index b6a6a330119..f4e15d497f9 100644 --- a/sdk/python/tests/test_repo_config.py +++ b/sdk/python/tests/test_repo_config.py @@ -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 @@ -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 @@ -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( @@ -44,7 +48,7 @@ def test_local_config(): def test_local_config_with_full_online_class(): - _test_config( + c = _test_config( dedent( """ project: foo @@ -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():