Skip to content

Commit b8346ff

Browse files
authored
fix: Handle hyphon in sqlite project name (#5575) (#5749)
* fix: handle hyphon in sqlite project name (#5575) Signed-off-by: Jacob Weinhold <29459386+jfw-ppi@users.noreply.github.com> * fix: handle hyphon in sqlite project name ([#5575](#5575)) Signed-off-by: Jacob Weinhold <29459386+jfw-ppi@users.noreply.github.com> --------- Signed-off-by: Jacob Weinhold <29459386+jfw-ppi@users.noreply.github.com>
1 parent 18a4e83 commit b8346ff

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sdk/python/feast/repo_config.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ def _validate_online_store_config(cls, values: Any) -> Any:
447447
online_config_class(**values["online_store"])
448448
except ValidationError as e:
449449
raise e
450+
450451
return values
451452

452453
@model_validator(mode="before")
@@ -502,14 +503,28 @@ def _validate_feature_server_config(cls, values: Any) -> Any:
502503

503504
@field_validator("project")
504505
@classmethod
505-
def _validate_project_name(cls, v: str) -> str:
506+
def _validate_project_name(cls, v: str, info: ValidationInfo) -> str:
507+
# Deferred import to avoid circular dependency during package initialization.
506508
from feast.repo_operations import is_valid_name
507509

510+
sqlite_compatible = False
511+
512+
online_store = info.data.get("online_store") if info else None
513+
if online_store is None or online_store == {}:
514+
sqlite_compatible = True
515+
elif isinstance(online_store, dict):
516+
sqlite_compatible = online_store.get("type", "sqlite") == "sqlite"
517+
508518
if not is_valid_name(v):
509519
raise ValueError(
510520
f"Project name, {v}, should only have "
511521
f"alphanumerical values, underscores, and hyphens but not start with an underscore or hyphen."
512522
)
523+
524+
if sqlite_compatible and "-" in v:
525+
raise ValueError(
526+
"Project names for SQLite online stores cannot contain hyphens because they are used in table names."
527+
)
513528
return v
514529

515530
@field_validator("flags")

0 commit comments

Comments
 (0)