From 2425d69848f2b6ecdad09d899e59c32ea0391cf9 Mon Sep 17 00:00:00 2001 From: boliri Date: Wed, 20 Nov 2024 13:46:39 +0100 Subject: [PATCH] feat: Generate absolute paths for file-based registry and online store when issuing 'feast init' commands --- sdk/python/feast/repo_operations.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sdk/python/feast/repo_operations.py b/sdk/python/feast/repo_operations.py index 4db0bbc6fd..ef45bbafa6 100644 --- a/sdk/python/feast/repo_operations.py +++ b/sdk/python/feast/repo_operations.py @@ -486,11 +486,28 @@ def init_repo(repo_name: str, template: str): os.remove(bootstrap_path) # Template the feature_store.yaml file - feature_store_yaml_path = repo_path / "feature_repo" / "feature_store.yaml" + feature_repo_path = repo_path / "feature_repo" + feature_store_yaml_path = feature_repo_path / "feature_store.yaml" + + # user-defined project name replace_str_in_file( feature_store_yaml_path, "project: my_project", f"project: {repo_name}" ) + # registry: replace relative path from template with absolute path + replace_str_in_file( + feature_store_yaml_path, + "registry: data/registry.db", + f"registry: {feature_repo_path}/data/registry.db", + ) + + # online store: replace relative path from template with absolute path + replace_str_in_file( + feature_store_yaml_path, + "path: data/online_store.db", + f"path: {feature_repo_path}/data/online_store.db", + ) + # Remove the __pycache__ folder if it exists import shutil