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

question on interactive behavior for redshift drivers #246

Open
fdefalco opened this issue Sep 7, 2023 · 2 comments
Open

question on interactive behavior for redshift drivers #246

fdefalco opened this issue Sep 7, 2023 · 2 comments

Comments

@fdefalco
Copy link
Contributor

fdefalco commented Sep 7, 2023

Why is there an interactive behavior setup for Redshift?
Perhaps there could be a parameter for the downloadJdbcDrivers function to automatically overwrite or skip if files are found?

for (db in dbms) {
    if (db == "redshift") {
      oldFiles <- list.files(pathToDriver, "Redshift")
      if (length(oldFiles) > 0) {
        message(sprintf("Prior JAR files have already been detected: '%s'. Do you want to delete them?", paste(oldFiles, collapse = "', '")))
        if (interactive() && utils::menu(c("Yes", "No")) == 1) {
          unlink(file.path(pathToDriver, oldFiles))
        }
      }
    }

Code Here

@schuemie
Copy link
Member

schuemie commented Sep 7, 2023

If the user is calling downloadJdbcDrivers() from the prompt, isn't it polite to ask before deleting something?

I agree that probably the non-interactive behavior (e.g. when downloadJdbcDrivers() is called for unit testing) should probably change to deleting the existing files.

@fdefalco
Copy link
Contributor Author

fdefalco commented Sep 7, 2023

It is indeed very polite, but only if you are using Redshift? Everyone else gets rude behavior? 😄

I was thinking perhaps an overwrite parameter for the function that can default to false. It can check for file.exists(file.path(pathToDriver, driverSource$fileName)) and skip if it exists or download if it doesn't.

@schuemie schuemie reopened this Sep 18, 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

No branches or pull requests

2 participants