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

feat: Make DescriptionMetadata inherit from GraphSerializable #461

Conversation

youngyjd
Copy link
Member

Summary of Changes

Make DescriptionMetadata inherit from GraphSerializable. The change is backward compatible. DescriptionMetadata can still be created along with TableMetadata, ColumnMetadata, or SchemaModel. At the same time, DescriptionMetadata can now created independently, as long as node key, relation start key, relation start label are provided.

Tests

  1. Add tests for descriptionmetadata to ensure Exception is raised if required data is missing when creating a node or a relation
  2. Add tests for Graph serialization.

CheckList

Make sure you have checked all steps below to ensure a timely review.

  • PR title addresses the issue accurately and concisely. Example: "Updates the version of Flask to v1.0.2"
  • PR includes a summary of changes.
  • PR adds unit tests, updates existing unit tests, OR documents why no test additions or modifications are needed.
  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
  • PR passes make test

@youngyjd
Copy link
Member Author

@allisonsuarez @feng-tao

Copy link
Contributor

@allisonsuarez allisonsuarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -117,7 +117,7 @@ def _create_record_iterator(self) -> Iterator[RDSModel]:


# TODO: this should inherit from ProgrammaticDescription in amundsen-common
class DescriptionMetadata:
class DescriptionMetadata(GraphSerializable):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @youngyjd , @crazy-2020 recently added https://github.com/amundsen-io/amundsendatabuilder/blob/master/databuilder/models/table_serializable.py#L10 to allow databuilder for mysql, could you make it as subclass as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually will let @crazy-2020 comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @feng-tao. I think it's fine to inherit only graph serializable in DescriptionMetadata. rds models do not have a single generic description model used for multiple entities.

@@ -165,10 +179,12 @@ def get_description_id(self) -> str:
else:
return "_" + self.source + "_description"

def __repr__(self) -> str:
return f'DescriptionMetadata({self.source!r}, {self.text!r})'
def get_description_default_key(self, start_key: Optional[str]) -> Optional[str]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this return optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Junda Yang <youngyjd@gmail.com>
Signed-off-by: Junda Yang <youngyjd@gmail.com>
Signed-off-by: Junda Yang <youngyjd@gmail.com>
@youngyjd youngyjd force-pushed the description-metadata-inherit-graphserializable branch from c2f0ac5 to daffa92 Compare March 25, 2021 17:26
Signed-off-by: Junda Yang <youngyjd@gmail.com>
@youngyjd youngyjd force-pushed the description-metadata-inherit-graphserializable branch from 51eaf4e to 6ebbe40 Compare March 25, 2021 17:31
@allisonsuarez allisonsuarez merged commit 7f095fb into amundsen-io:master Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants