Skip to content
Merged
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
17 changes: 16 additions & 1 deletion sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Loading