diff --git a/sdgx/data_models/metadata.py b/sdgx/data_models/metadata.py index d33ce8fd..975aa6fe 100644 --- a/sdgx/data_models/metadata.py +++ b/sdgx/data_models/metadata.py @@ -45,6 +45,7 @@ class Metadata(BaseModel): """ @field_validator("column_list") + # @classmethod def check_column_list(cls, v) -> Any: # check if v has duplicate element if len(v) == len(set(v)): @@ -70,6 +71,7 @@ def check_column_list(cls, v) -> Any: discrete_columns: Set[str] = set() datetime_columns: Set[str] = set() datetime_format: Dict = defaultdict(str) + const_values: Dict = defaultdict(str) # version info version: str = "1.0" @@ -206,6 +208,7 @@ def set(self, key: str, value: Any): key in self.model_fields and key not in self.tag_fields and key not in self.format_fields + and key not in self.value_fields ): raise MetadataInitError( f"Set {key} not in tag_fields, try set it directly as m.{key} = value" @@ -252,6 +255,9 @@ def add(self, key: str, values: str | Iterable[str]): # already in fields that contains dict if key in list(self.format_fields): self.get(key).update(values) + + if key in list(self.value_fields): + self.get(key).update(values) # in extend if self._extend.get(key, None) is None: