diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b4ab0e9..a068cbfe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Bug Fixes - Fix templates +- Fixed the bug when exporting the component. ## [0.2.0](https://github.com/SuperDuperDB/superduperdb/compare/0.1.3...0.2.0]) (2024-Jun-21) diff --git a/superduperdb/base/leaf.py b/superduperdb/base/leaf.py index ac8c2f6a5..d16aefff6 100644 --- a/superduperdb/base/leaf.py +++ b/superduperdb/base/leaf.py @@ -217,6 +217,8 @@ def dict(self, metadata: bool = True, defaults: bool = True): if not defaults: for k, v in self.defaults.items(): + if k in {'identifier'}: + continue if k in r and r[k] == v: del r[k] diff --git a/superduperdb/components/component.py b/superduperdb/components/component.py index 890b23e49..53756429b 100644 --- a/superduperdb/components/component.py +++ b/superduperdb/components/component.py @@ -6,6 +6,7 @@ import json import os import typing as t +import uuid from collections import namedtuple from functools import wraps @@ -180,12 +181,18 @@ def cleanup(self, db: Datalayer): @property def metadata(self): """Get metadata of the component.""" - return { + metadata = { 'type_id': self.type_id, 'version': self.version, - 'uuid': self.uuid, } + try: + uuid.UUID(self.uuid) + metadata['uuid'] = self.uuid + except ValueError: + pass + return metadata + @property def dependencies(self): """Get dependencies on the component.""" diff --git a/superduperdb/components/datatype.py b/superduperdb/components/datatype.py index 3d5fb7edf..0687269b0 100644 --- a/superduperdb/components/datatype.py +++ b/superduperdb/components/datatype.py @@ -722,7 +722,10 @@ def dict(self, metadata: bool = True, defaults: bool = True): @component() def get_serializer( - identifier: str, method: str, encodable: str, db: t.Optional['Datalayer'] = None + identifier: str, + method: str, + encodable: str = "encodable", + db: t.Optional['Datalayer'] = None, ): """Get a serializer.