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

fix: add csv badges back in Quickstart #418

Merged
merged 13 commits into from
Dec 14, 2020

Conversation

jornh
Copy link
Contributor

@jornh jornh commented Dec 2, 2020

Summary of Changes

Add back badges at both table and column levels in Quickstart. They were missing since the API change splitting badges and tags introduced as part of metadata and frontend 3.0.0 versions

Update: We decided to do the table level handling with what's already merged in #417

Tests

Added testing to CvsTableColumnExtractor of badges at table and column level.

Documentation

N/A

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

@jornh
Copy link
Contributor Author

jornh commented Dec 3, 2020

@allisonsuarez ready for review.

I notice you have started work on an alternative PR - sorry I wasn't able to complete this sooner, so you could have saved some cycles.

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.

Left some questions about the changes in table_metadata but overall the functionality should be good

example/sample_data/sample_col.csv Outdated Show resolved Hide resolved
databuilder/models/table_metadata.py Outdated Show resolved Hide resolved
@jornh jornh changed the title fix: csv badges back in quickstart fix: add csv badges back in Quickstart Dec 9, 2020
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! thank you for doing this :)

@jornh
Copy link
Contributor Author

jornh commented Dec 10, 2020

All green again

@@ -18,6 +18,10 @@ def __repr__(self) -> str:
return 'Badge({!r}, {!r})'.format(self.name,
self.category)

def __eq__(self, other: Any) -> bool: # type: ignore[override]
Copy link
Member

Choose a reason for hiding this comment

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

other: Badge

Copy link
Contributor Author

@jornh jornh Dec 11, 2020

Choose a reason for hiding this comment

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

Oh yeah of course! Thanks - currently AFK but will change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, apart from that it then throws an error

    def __eq__(self, other: Badge) -> bool:
E   NameError: name 'Badge' is not defined

Apparently the Class itself isn't know at that point - which I find a little strange. So I'm keeping Any unless you know a trick.

I got rid if the # type: ignore[override] though 🙂


Oh wait, through this i found out it needs to be other: 'Badge' and then mypy itself gives the full recommended way:

mypy .
databuilder/models/badge.py:21: error: Argument 1 of "__eq__" is incompatible with supertype "object"; supertype defines the argument type as "object"
databuilder/models/badge.py:21: note: This violates the Liskov substitution principle
databuilder/models/badge.py:21: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
databuilder/models/badge.py:21: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
databuilder/models/badge.py:21: note:     def __eq__(self, other: object) -> bool:
databuilder/models/badge.py:21: note:         if not isinstance(other, Badge):
databuilder/models/badge.py:21: note:             return NotImplemented
databuilder/models/badge.py:21: note:         return <logic to compare two Badge instances>

Copy link
Contributor

Choose a reason for hiding this comment

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

wow that's so useful

@jornh jornh requested a review from feng-tao December 11, 2020 08:37
@allisonsuarez allisonsuarez merged commit c0296b7 into amundsen-io:master Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants