Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata.to_dict fails on metadata instances pre 1.9.0 #1739

Closed
amontanez24 opened this issue Jan 11, 2024 · 0 comments · Fixed by #1747
Closed

Metadata.to_dict fails on metadata instances pre 1.9.0 #1739

amontanez24 opened this issue Jan 11, 2024 · 0 comments · Fixed by #1747
Assignees
Labels
bug Something isn't working
Milestone

Comments

@amontanez24
Copy link
Contributor

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDV version: 1.9.0
  • Python version: Any
  • Operating System: Any

Error Description

If you saved a synthesizer on a version of sdv < 1.9.0, and then you load it and call

metadata.to_dict

it will crash with the following error

  File "/usr/local/lib/python3.11/site-packages/sdv/metadata/single_table.py", line 295, in to_dict
    value = getattr(self, f'{key}') if key != 'METADATA_SPEC_VERSION' else self._version
            ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SingleTableMetadata' object has no attribute 'column_relationships'

This is because of the following line:
https://github.com/sdv-dev/SDV/blob/6f8f50b4b8d722d67b7da03fa3e75344f3f03a9f/sdv/metadata/single_table.py#L295C26-L295C26
We should handle the case where the attribute is not on the metadata class more gracefully.

Steps to reproduce

  • Load a synthesizer that was created in a version of sdv < 1.9.0
  • get its metadata
  • call metadata.to_dict
@amontanez24 amontanez24 added the bug Something isn't working label Jan 11, 2024
@amontanez24 amontanez24 self-assigned this Feb 8, 2024
@amontanez24 amontanez24 added this to the 1.10.0 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant