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 verbosity to drop_unknown_references #1845

Closed
npatki opened this issue Mar 11, 2024 · 0 comments · Fixed by #1854
Closed

Add verbosity to drop_unknown_references #1845

npatki opened this issue Mar 11, 2024 · 0 comments · Fixed by #1854
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@npatki
Copy link
Contributor

npatki commented Mar 11, 2024

Problem Description

Related to #1792: The new utility function for drop_unknown_references will be used to drop invalid foreign key rows that do not point to an existing parent. When using it, I receive data with referential integrity but there is no indication as to how many rows were dropped and how many remain.

Expected behavior

Add an optional parameter verbose to the end of this function. By default, it will be True.

When set to True, there should be a message printed out that tells me how many rows remain per table. This should be pretty printed so that the numbers align -- perhaps as a pandas DatFrame.

>>> valid_data = drop_unknown_references(metadata, data, verbose=True)
Success! All foreign keys have referential integrity. 

Table Name    # Rows (Original)    # Invalid Rows   # Rows (New)
sessions      1200                 50               1150     
transactions  5000                 0                5000

Note that the # Rows (Original) should be equal to # Invalid Keys + # Rows (New)

If verbose=False, then do not show this message.

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

Successfully merging a pull request may close this issue.

3 participants