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

Warn users to save their metadata file after auto-detecting/updating it #1786

Merged
merged 9 commits into from
Feb 13, 2024

Conversation

R-Palazzo
Copy link
Contributor

CU-86az6hhgm
Resolve #1762

@R-Palazzo R-Palazzo requested a review from a team as a code owner February 9, 2024 07:25
@sdv-team
Copy link
Contributor

sdv-team commented Feb 9, 2024

@R-Palazzo R-Palazzo removed the request for review from a team February 9, 2024 07:25
@R-Palazzo R-Palazzo force-pushed the issue-1762-save-metadata branch from 11f9b9b to e2e031b Compare February 9, 2024 07:52
@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7a796d5) 97.25% compared to head (6b0c5cf) 97.27%.
Report is 3 commits behind head on main.

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1786      +/-   ##
==========================================
+ Coverage   97.25%   97.27%   +0.02%     
==========================================
  Files          49       49              
  Lines        4624     4662      +38     
==========================================
+ Hits         4497     4535      +38     
  Misses        127      127              

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

Copy link
Contributor

@amontanez24 amontanez24 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, but I have a couple questions to maybe reduce some lines of code

@@ -1069,6 +1082,7 @@ def load_from_json(cls, filepath):
'class and version.'
)

cls._updated = False
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make the default false?

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, done in 18ee971

Comment on lines 73 to 74
self.metadata._check_updated_flag()
if self.metadata._updated:
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if you need to store the _updated flag if you can just directly call _check_metadata_updated

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, I did it to be consistent between single and multi-table metadata. I removed it in d20f32a

@@ -29,6 +29,20 @@ class MultiTableMetadata:
def __init__(self):
self.tables = {}
self.relationships = []
self._multi_table_updated = None
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 have the default be False here for consistency? We could also rename it to just _updated, but I'm not sure if that would be more or less confusing.

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, done in 6b0c5cf

Comment on lines 503 to 504
table._detect_columns(data)
table._updated = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we call table._detect_columns here instead of just table.detect_from_dataframe? We wouldn't need to set the table's updated flag here if we use the public method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before we seem to be using table.detect_from_dataframe from this: d1ae6de
Maybe @amontanez24 remembers a reason for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, looks like we use it to avoid double logging the detected table. In that case, we could move the single table _updated flag switch to _detect_columns instead of detect_from_dataframe

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, done in 6b0c5cf

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.

thanks for addressing!

Copy link
Contributor

@amontanez24 amontanez24 left a comment

Choose a reason for hiding this comment

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

LGTM!

@R-Palazzo R-Palazzo merged commit 946d2c5 into main Feb 13, 2024
37 checks passed
@R-Palazzo R-Palazzo deleted the issue-1762-save-metadata branch February 13, 2024 16:50
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.

Warn users to save their metadata file after auto-detecting/updating it
5 participants