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

Create MultiTableMetadata.add_table method #1024

Closed
npatki opened this issue Sep 21, 2022 · 0 comments
Closed

Create MultiTableMetadata.add_table method #1024

npatki opened this issue Sep 21, 2022 · 0 comments
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@npatki
Copy link
Contributor

npatki commented Sep 21, 2022

Problem Description

As a user, I would like the ability to create multi table metadata using Python. Right now, this is only partially supported because i can add columns but not new tables.

Expected behavior

Create an add_table method for the MultiTableMetadata object. This will create an empty table, after which the user can use add_column to fill out the columns.

Parameters

  • (required) table_name: A string with the name of the table to add
metadata.add_table(table_name='users')
metadata.add_column(column_name='user_id', sdtype='text', regex_format='U_[0-9]{4}')
metadata.add_column(column_name='age', sdtype='numerical')

Error Handling

Invalid Table Name: Table name must be a string and cannot be empty

metadata.add_table(table_name='')
Error: Invalid table name (''). The table name must be a non-empty string.

Repeated Table Name: The table name cannot already exist

# assume the 'users' table already exists
metadata.add_table(table_name='users')
Error: Cannot add a table named 'users' because it already exists in the metadata. Please choose a different name.

Validation: In metadata.validate() we should add another check to validate that all tables have at least 1 column

metadata.add_table(table_name='sessions')
metadata.validate()
Error: Table 'sessions' has 0 columns. Use 'add_column' to specify its columns.
@npatki npatki added the feature request Request for a new feature label Sep 21, 2022
@npatki npatki added this to the 1.0.0 milestone Sep 21, 2022
@amontanez24 amontanez24 self-assigned this Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants