Skip to content

Commit

Permalink
Fixed the bug when exporting the component.
Browse files Browse the repository at this point in the history
  • Loading branch information
jieguangzhou committed Jul 5, 2024
1 parent 72d75f9 commit b33e25f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions superduperdb/base/leaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
11 changes: 9 additions & 2 deletions superduperdb/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import json
import os
import typing as t
import uuid
from collections import namedtuple
from functools import wraps

Expand Down Expand Up @@ -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."""
Expand Down
5 changes: 4 additions & 1 deletion superduperdb/components/datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b33e25f

Please sign in to comment.