-
Notifications
You must be signed in to change notification settings - Fork 181
COPY = TRUE is creating a global temporary table of some kind. Not a session specific temporary table. #574
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
Comments
Using Postgres btw. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
As I suspected, it's not a problem for RPostgres, but is for RPostgreSQL: library(dbplyr)
library(dplyr, warn.conflicts = FALSE)
# RPostgres --------------------------------------------------------------------
con1 <- DBI::dbConnect(RPostgres::Postgres(), dbname = "test")
con2 <- DBI::dbConnect(RPostgres::Postgres(), dbname = "test")
copy_to(con1, data.frame(x = 1), "df")
DBI::dbListTables(con1)
#> [1] "df"
DBI::dbListTables(con2)
#> character(0)
# RPostgresSQL ------------------------------------------------------------------
con1 <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), dbname = "test")
con2 <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), dbname = "test")
copy_to(con1, data.frame(x = 1), "df")
DBI::dbListTables(con1)
#> [1] "df" "df"
DBI::dbListTables(con2)
#> [1] "df" "df"
DBI::dbRemoveTable(con1, "df")
#> [1] TRUE Created on 2021-01-21 by the reprex package (v0.3.0.9001) |
The problem is that in dbplyr 2.0.0:
This significantly reduces the complexity of dbplyr, but unfortunately RPostgresSQL doesn't support the One simple option would be to make |
I see. Thanks for that. Is RPostgres a more reliable package? I see there hasn't been an update to the RPostgreSQL package in 3.5 years. |
Yes, it’s actively maintained and generally more reliable. |
This seems like a bug in the new version of dbplyr.
When I use copy = TRUE, or the underlying copy_to(..., temporary = TRUE) the table is not very temporary. Even if I create a new data connection to the db the table is still there.
First I am posting the reprex using dbplyr 1.4.4. Below that I will paste the reprex with dbplyr 2.0.0:
Created on 2021-01-20 by the reprex package (v0.3.0)
Now for dbplyr 2.0.0:
Created on 2021-01-20 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: