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

Show confirmation prompt for dropping the table if and only if a table exists #22

Open
rodrigomorales1 opened this issue Aug 24, 2021 · 0 comments

Comments

@rodrigomorales1
Copy link
Contributor

rodrigomorales1 commented Aug 24, 2021

This is a feature request.

The current behavior is that a confirmation prompt is shown whenever the script is used. I think that it would be less redundant if the confirmation prompt were shown if there exists a table in the specified schema.

I think that this behavior can be changed by adding a conditional that checks if a table exists in the specified schema in the following part of the code (specifically, where choice is).

# load given file in table
if args.file and args.table:
table = args.table
if table == "Posts":
# If the user has not explicitly asked for loading the body, we replace it with NULL
if not args.with_post_body:
specialRules[("Posts", "Body")] = "NULL"
choice = input("This will drop the {} table. Are you sure [y/n]?".format(table))
if len(choice) > 0 and choice[0].lower() == "y":

I think doing this is necessary for making the script fully scriptable since the current behavior requires the interaction of the user or some workaround for automating it.

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

No branches or pull requests

1 participant