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

Add metadata validation #527

Merged

Conversation

R-Palazzo
Copy link
Contributor

CU-86ayrkg1a
Resolve #526

@R-Palazzo R-Palazzo requested a review from a team as a code owner November 22, 2023 16:32
@sdv-team
Copy link
Collaborator

@R-Palazzo R-Palazzo removed the request for review from a team November 22, 2023 16:33
Comment on lines +47 to +56
if 'tables' not in metadata:
raise ValueError(
'Multi table reports expect metadata to contain a "tables" key with a mapping'
' from table names to metadata for each table.'
)
for table_name, table_metadata in metadata['tables'].items():
if 'columns' not in table_metadata:
raise ValueError(
f'The metadata for table "{table_name}" is missing a "columns" key.'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@npatki should we error in the case where the metadata is malformed? More specifically, f a users gives metadata with an empty table or empty column, should we error?

Copy link
Contributor

Choose a reason for hiding this comment

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

@amontanez24 yeah that's probably a good idea. Though I'm neutral on whether or not there's an explicit error message for this case vs. the report just naturally crashing because it cannot access those key names.

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.

🚢

Copy link
Contributor

@npatki npatki left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +47 to +56
if 'tables' not in metadata:
raise ValueError(
'Multi table reports expect metadata to contain a "tables" key with a mapping'
' from table names to metadata for each table.'
)
for table_name, table_metadata in metadata['tables'].items():
if 'columns' not in table_metadata:
raise ValueError(
f'The metadata for table "{table_name}" is missing a "columns" key.'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@amontanez24 yeah that's probably a good idea. Though I'm neutral on whether or not there's an explicit error message for this case vs. the report just naturally crashing because it cannot access those key names.

@R-Palazzo R-Palazzo merged commit 9e83c54 into diagnostic_report_updates Nov 22, 2023
90 checks passed
@R-Palazzo R-Palazzo deleted the diagnostic_report_fix_error_message branch November 22, 2023 19:09
R-Palazzo added a commit that referenced this pull request Nov 27, 2023
R-Palazzo added a commit that referenced this pull request Nov 27, 2023
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.

4 participants