Skip to content

Commit

Permalink
Fix keys
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho committed Feb 8, 2023
1 parent 775b474 commit 5c69200
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions sdv/metadata/single_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ def to_dict(self):
"""Return a python ``dict`` representation of the ``SingleTableMetadata``."""
metadata = {}
for key in self._KEYS:
if key in ('columns', 'primary_key', 'alternate_keys', 'sequence_key', 'sequence_index'):
value = getattr(self, f'{key}')
else:
value = \
getattr(self, f'_{key}') if key != 'METADATA_SPEC_VERSION' else self._version
value = getattr(self, f'{key}') if key != 'METADATA_SPEC_VERSION' else self._version
if value:
metadata[key] = value

Expand Down Expand Up @@ -484,10 +480,7 @@ def _load_from_dict(cls, metadata):
for key in instance._KEYS:
value = deepcopy(metadata.get(key))
if value:
if key in ('columns', 'primary_key', 'alternate_keys', 'sequence_key', 'sequence_index'):
setattr(instance, f'{key}', value)
else:
setattr(instance, f'_{key}', value)
setattr(instance, f'{key}', value)

return instance

Expand Down

0 comments on commit 5c69200

Please sign in to comment.