diff --git a/sdk/python/feast/repo_config.py b/sdk/python/feast/repo_config.py index ac4383e1142..2cd148edb66 100644 --- a/sdk/python/feast/repo_config.py +++ b/sdk/python/feast/repo_config.py @@ -447,6 +447,7 @@ def _validate_online_store_config(cls, values: Any) -> Any: online_config_class(**values["online_store"]) except ValidationError as e: raise e + return values @model_validator(mode="before") @@ -502,14 +503,28 @@ def _validate_feature_server_config(cls, values: Any) -> Any: @field_validator("project") @classmethod - def _validate_project_name(cls, v: str) -> str: + def _validate_project_name(cls, v: str, info: ValidationInfo) -> str: + # Deferred import to avoid circular dependency during package initialization. from feast.repo_operations import is_valid_name + sqlite_compatible = False + + online_store = info.data.get("online_store") if info else None + if online_store is None or online_store == {}: + sqlite_compatible = True + elif isinstance(online_store, dict): + sqlite_compatible = online_store.get("type", "sqlite") == "sqlite" + if not is_valid_name(v): raise ValueError( f"Project name, {v}, should only have " f"alphanumerical values, underscores, and hyphens but not start with an underscore or hyphen." ) + + if sqlite_compatible and "-" in v: + raise ValueError( + "Project names for SQLite online stores cannot contain hyphens because they are used in table names." + ) return v @field_validator("flags")