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 warnings that were suggested from metadata bughunt #2203

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

lajohn4747
Copy link
Contributor

Handle the remaining usability issues by adding warnings to let the user know that they will get a default table name.

Also add errors to prevent the user from adding invalid SingleTableMetadata arguments into Metadata

Copy link
Member

@fealho fealho 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, I left two minor comments.

@@ -409,6 +409,8 @@ def update_columns(self, table_name, column_names, **kwargs):
**kwargs:
Any key word arguments that describe metadata for the columns.
"""
if not isinstance(column_names, list):
Copy link
Member

Choose a reason for hiding this comment

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

This wouldn't work for tuples and other list-like objects, something like pandas.api.types is_list_like could handle those.

If that's expected then you can leave as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's expected. Don't imagine a user putting in something more complicated than a list of strings and it's easy enough to convert.

sdv/metadata/multi_table.py Show resolved Hide resolved
sdv/metadata/metadata.py Outdated Show resolved Hide resolved
tests/unit/metadata/test_multi_table.py Show resolved Hide resolved
Comment on lines +80 to +81
metadata_dict = {'tables': {table_name: table_metadata.to_dict()}}
metadata = Metadata.load_from_dict(metadata_dict)
Copy link
Contributor

Choose a reason for hiding this comment

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

was this crashing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it was causing the single table metadata name to be missing since it gave it a default table (it was in a SingleTableMetadata format)

@lajohn4747 lajohn4747 merged commit f0b44cc into feature/metadata Sep 3, 2024
39 checks passed
@lajohn4747 lajohn4747 deleted the add_metadata_warnings branch September 3, 2024 21:05
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