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

Allow overwrite parameter in compute #1175

Closed
carlganz opened this issue Feb 27, 2023 · 2 comments · Fixed by #1324
Closed

Allow overwrite parameter in compute #1175

carlganz opened this issue Feb 27, 2023 · 2 comments · Fixed by #1324

Comments

@carlganz
Copy link

library(dplyr)
library(dbplyr)

con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)

tbl(con, "mtcars") %>%
  filter(cyl == 4) %>%
# works fine
  compute(temporary = FALSE, name = "mtcars_test")

tbl(con, "mtcars") %>%
  filter(cyl == 4 | cyl == 6) %>%
# error mtcars_test already exists
  compute(temporary = FALSE, name = "mtcars_test", overwrite = TRUE)

I can make a PR if you'd like

@carlganz
Copy link
Author

So it turns out this is maybe more complicated than I anticipated. I figure either this function gets an extra overwrite parameter and add if table exists drop table at top if overwrite=TRUE

Or update function here and add dbRemoveTable if it exists and overwrite=T, and put the whole thing inside a transaction.

I don't have a sense of what would be better

@carlganz
Copy link
Author

carlganz commented Jul 3, 2023

Thanks @mgirlich !!!!

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 a pull request may close this issue.

1 participant