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

Create MultiTableMetadata class #883

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

Create MultiTableMetadata class #883

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

Comments

@amontanez24
Copy link
Contributor

Problem Description

As a user, it would be useful to have a programmatic way to interact with the metadata for all of the tables in my dataset.

Expected behavior

  • In the metadata module, add a class called MultiTableMetadata
  • The class needs to store a dictionary that maps all of the table names to their SingleTableMetadata class instances and another dictionary that stores the relationships.
  • The __init__ requires no parameters
  • There should be a to_dict method that returns the underlying dictionaries in the proper json format
>>> python_dict = metadata.to_dict()
{
  "tables": {
    "accounts": { <Table Spec> },
    "branches": { <Table Spec> }
  }, 
  "relationships": [
    { <Relationship Spec>},
    { <Relationship Spec> },
  ],
}
  • There should be an internal _load_from_dict(dict) method that returns a class instance with the values set based on a provided python dictionary that matches the json spec. The instance should call the SingleTableMetadata._load_from_dict to create the SingleTableMetadata instances.
metadata = SingleTableMetadata._load_from_dict(dict)
  • The __repr__ method should be overridden to print the full dictionary representation of the json for the MultiTableMetadata.
>>> print(metadata)
{
  "tables": {
    "accounts": { <Table Spec> },
    "branches": { <Table Spec> }
  }, 
  "relationships": [
    { <Relationship Spec>},
    { <Relationship Spec> },
  ],
}
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