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 auto-detection should ensure primary keys are unique (special sdtypes are not exempt from this rule!) #1876

Merged
merged 5 commits into from
Mar 28, 2024

Conversation

R-Palazzo
Copy link
Contributor

CU-86azuyq0t
Resolve #1871

@R-Palazzo R-Palazzo requested a review from a team as a code owner March 27, 2024 11:45
@R-Palazzo R-Palazzo removed the request for review from a team March 27, 2024 11:45
Copy link
Contributor

@frances-h frances-h left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -525,6 +525,8 @@ def _detect_columns(self, data):
for field in data:
column_data = data[field]
has_nan = column_data.isna().any()
is_unique = column_data.nunique() == len(column_data)
valid_potential_primary_key = is_unique and not has_nan
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use column_data.is_unique here instead of using nunique?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good point, done in bbaeac1

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.49%. Comparing base (6011d53) to head (bbaeac1).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1876   +/-   ##
=======================================
  Coverage   97.49%   97.49%           
=======================================
  Files          51       51           
  Lines        4907     4908    +1     
=======================================
+ Hits         4784     4785    +1     
  Misses        123      123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@R-Palazzo R-Palazzo merged commit fd019b9 into main Mar 28, 2024
37 checks passed
@R-Palazzo R-Palazzo deleted the issue-1871-primary-key-detection branch March 28, 2024 11:49
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.

Metadata auto-detection should ensure primary keys are unique (special sdtypes are not exempt from this rule!)
5 participants