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(ingest/snowflake): fix usage enum bug #8649

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

hsheth2
Copy link
Collaborator

@hsheth2 hsheth2 commented Aug 16, 2023

Without the .value, it would produce 'BucketDuration.DAY' instead of 'DAY'.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

Without the .value, it would produce 'BucketDuration.DAY' instead of 'DAY'.
@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Aug 16, 2023
Copy link
Collaborator

@mayurinehate mayurinehate left a comment

Choose a reason for hiding this comment

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

LGTM.

Interestingly the earlier code did not lead to any issue as f"{BucketDuration.DAY}" is translated to "DAY" and therefore hopefully had no adverse effects on people using snowflake usage.

@hsheth2
Copy link
Collaborator Author

hsheth2 commented Aug 17, 2023

@mayurinehate yeah I'm not fully sure, since the enum does inherit from str. But I didn't want to spend too much time understanding this - I saw the error when testing locally and this fixed it for me.

@hsheth2 hsheth2 added the merge-pending-ci A PR that has passed review and should be merged once CI is green. label Aug 17, 2023
Copy link
Collaborator

@asikowitz asikowitz left a comment

Choose a reason for hiding this comment

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

The __format__ function of StrEnum uses .value whil __str__ uses the full name. Surprised mypy didn't catch this but as Mayuri says, this didn't actually break anything

@asikowitz
Copy link
Collaborator

Merging as test failure should be unrelated

@asikowitz asikowitz merged commit 130f908 into datahub-project:master Aug 17, 2023
44 of 45 checks passed
@asikowitz asikowitz deleted the snowflake-usage branch August 17, 2023 17:27
asikowitz pushed a commit to asikowitz/datahub that referenced this pull request Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata merge-pending-ci A PR that has passed review and should be merged once CI is green.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants