From 328dfb885194154972850f44ab8d0508d2cc1f2e Mon Sep 17 00:00:00 2001 From: Adam Kariv Date: Thu, 14 Nov 2024 14:16:35 +0200 Subject: [PATCH] More robust field --- odds/common/metadata_store/dataset_factory.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odds/common/metadata_store/dataset_factory.py b/odds/common/metadata_store/dataset_factory.py index 98c9fa0..eff5678 100644 --- a/odds/common/metadata_store/dataset_factory.py +++ b/odds/common/metadata_store/dataset_factory.py @@ -13,6 +13,9 @@ def dataset_factory(data: dict) -> Dataset: fields = [] for f in resource['fields']: f.update(json.loads(f.pop('props', None) or '{}')) + f = dict( + (k, v) for k, v in f.items() if k in Field.__dataclass_fields__ + ) fields.append(Field(**f)) resource['fields'] = fields data['resources'] = [resource_factory(**r) for r in resources]