diff --git a/ixmp4/data/db/optimization/equation/model.py b/ixmp4/data/db/optimization/equation/model.py index e7588043..ee8d2898 100644 --- a/ixmp4/data/db/optimization/equation/model.py +++ b/ixmp4/data/db/optimization/equation/model.py @@ -31,11 +31,12 @@ def validate_data(self, key: Any, data: dict[str, Any]) -> dict[str, Any]: data_to_validate = copy.deepcopy(data) del data_to_validate["levels"] del data_to_validate["marginals"] - _ = utils.validate_data( - host=self, - data=data_to_validate, - columns=self.columns, - ) + if data_to_validate != {}: + _ = utils.validate_data( + host=self, + data=data_to_validate, + columns=self.columns, + ) return data __table_args__ = (db.UniqueConstraint("name", "run__id"),) diff --git a/ixmp4/data/db/optimization/variable/model.py b/ixmp4/data/db/optimization/variable/model.py index 32cfae59..548e7499 100644 --- a/ixmp4/data/db/optimization/variable/model.py +++ b/ixmp4/data/db/optimization/variable/model.py @@ -32,11 +32,12 @@ def validate_data(self, key: Any, data: dict[str, Any]) -> dict[str, Any]: data_to_validate = copy.deepcopy(data) del data_to_validate["levels"] del data_to_validate["marginals"] - _ = utils.validate_data( - host=self, - data=data_to_validate, - columns=self.columns, - ) + if data_to_validate != {}: + _ = utils.validate_data( + host=self, + data=data_to_validate, + columns=self.columns, + ) return data __table_args__ = (db.UniqueConstraint("name", "run__id"),)