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

Add load_from_json and save_to_json methods to the MultiTableMetadata #891

Closed
amontanez24 opened this issue Jul 8, 2022 · 0 comments · Fixed by #938
Closed

Add load_from_json and save_to_json methods to the MultiTableMetadata #891

amontanez24 opened this issue Jul 8, 2022 · 0 comments · Fixed by #938
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@amontanez24
Copy link
Contributor

Problem Description

As a user, it would be useful if I could create an instance of the MultiTableMetadata class from a json file. It would also be useful if I could save an existing instance to a json file.

Expected behavior

  • Add a load_from_json method
    • Parameters:
      • filepath: string that is the path to json file
    • Errors:
      • If the json file doesn't contain the SCHEMA_VERSION attribute, then raise the following error
      Error: This metadata file is incompatible with the SingleTableMetadata class and version.
    • To create the SingleTableMetadata instances you can call SingleTableMetadata._load_from_dict.
>>> metadata = SingleTableMetadata.load_from_json(filepath='project/metadata.json')
  • Add a save_to_json method
    • Parameters:
      • filepath: string that is the path to save the file to
    • Errors:
      • If there is already a file in the path location, raise the following error
      Error: A file named 'metadata.json' already exists in this folder. Please specify a different filename.
>>> metadata.save_to_json(filepath='project/metadata.json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants