diff --git a/nannyml/config.py b/nannyml/config.py index 2e8e4743..170d86e8 100644 --- a/nannyml/config.py +++ b/nannyml/config.py @@ -88,11 +88,11 @@ def _parse_thresholds(cls, value: Dict[str, Any]): class Config(BaseModel): - input: Optional[InputConfig] + input: Optional[InputConfig] = None calculators: List[CalculatorConfig] - scheduling: Optional[SchedulingConfig] + scheduling: Optional[SchedulingConfig] = None - ignore_errors: Optional[bool] + ignore_errors: Optional[bool] = None @classmethod @lru_cache(maxsize=1) diff --git a/nannyml/io/db/entities.py b/nannyml/io/db/entities.py index f282b31e..7800beac 100644 --- a/nannyml/io/db/entities.py +++ b/nannyml/io/db/entities.py @@ -11,6 +11,7 @@ from datetime import datetime from typing import List, Optional +from pydantic import ConfigDict from sqlmodel import Field, Relationship, SQLModel @@ -42,6 +43,11 @@ class Run(SQLModel, table=True): # type: ignore[call-arg] Stored in the ``run`` table. """ + # Ignore clash of `model_id` field name with default protected namespace `model_` + # See: https://github.com/pydantic/pydantic/discussions/7121 + # Better solution using `alias` is not possible due to SQLModel issue + model_config = ConfigDict(protected_namespaces=()) + #: Foreign key in all ``metric`` tables id: Optional[int] = Field(default=None, primary_key=True) @@ -61,6 +67,11 @@ class Metric(SQLModel): Base ``Metric`` definition. """ + # Ignore clash of `model_id` field name with default protected namespace `model_` + # See: https://github.com/pydantic/pydantic/discussions/7121 + # Better solution using `alias` is not possible due to SQLModel issue + model_config = ConfigDict(protected_namespaces=()) + #: The technical identifier for this database row id: Optional[int] = Field(default=None, primary_key=True)