From c374b50039e13581b2b8e83c1044b18f69f53299 Mon Sep 17 00:00:00 2001 From: Angelo Lacson Date: Wed, 2 Sep 2026 12:20:37 +0200 Subject: [PATCH] fix: Validate SQLite project names during init Signed-off-by: Angelo Lacson --- sdk/python/feast/repo_operations.py | 10 ++++++++++ sdk/python/tests/unit/local_feast_tests/test_init.py | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/sdk/python/feast/repo_operations.py b/sdk/python/feast/repo_operations.py index 02747ac4b54..660e0ed993a 100644 --- a/sdk/python/feast/repo_operations.py +++ b/sdk/python/feast/repo_operations.py @@ -38,6 +38,10 @@ logger = logging.getLogger(__name__) +_SQLITE_ONLINE_STORE_TEMPLATES = frozenset( + {"athena", "aws", "gcp", "local", "minimal", "pytorch_nlp", "ray", "spark"} +) + def py_path_to_module(path: Path) -> str: return ( @@ -580,6 +584,12 @@ def init_repo(repo_name: str, template: str, repo_path: Optional[str] = None): param_hint="PROJECT_DIRECTORY", ) + if "-" in repo_name and template.lower() in _SQLITE_ONLINE_STORE_TEMPLATES: + raise BadParameter( + message="Project names for SQLite online stores cannot contain hyphens because they are used in table names.", + param_hint="PROJECT_DIRECTORY", + ) + # Determine where to create the repository if repo_path: # User specified a custom path diff --git a/sdk/python/tests/unit/local_feast_tests/test_init.py b/sdk/python/tests/unit/local_feast_tests/test_init.py index 1f3c0993845..218e8e6a317 100644 --- a/sdk/python/tests/unit/local_feast_tests/test_init.py +++ b/sdk/python/tests/unit/local_feast_tests/test_init.py @@ -81,3 +81,15 @@ def test_postgres_template_registry_path_is_parameterized() -> None: contents = template_fs_yaml.read_text(encoding="utf-8") expected = "path: postgresql://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME" assert expected in contents + + +def test_repo_init_rejects_hyphenated_sqlite_project_name() -> None: + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + runner = CliRunner() + + result = runner.run(["init", "hyphen-name"], cwd=temp_path) + + assert result.returncode != 0 + assert "SQLite online stores cannot contain hyphens" in result.stderr.decode() + assert not (temp_path / "hyphen-name").exists()