-
Notifications
You must be signed in to change notification settings - Fork 173
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
copy_to
fails to overwrite a temporary table
#258
Comments
I don't have SQL server locally — while I've simulated the change and I'm reasonably certain it should fix the problem, I would appreciate someone (@edgararuiz ?) also checking this with a real SQL server instance. |
FWIW, A pull request follows. I'm working on a terraformed setup of various databases on Azure for testing, happy to share. |
I saw this was closed in the March commit and mentioned in the change log. However, the same exact reprex fails in dbplyr 1.4.0 on sql server |
Having met this same problem (with dbplyr at current master), I see that both I currently use the suggested workaround from above: An extract from my traceback:
|
This is to add that currently (using dbplyr 2.1.1), > try(copy_to(con, test, "##test", overwrite = TRUE))
Error in new_result(connection@ptr, statement, immediate) :
nanodbc/nanodbc.cpp:1594: 00000: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]There is already an object named '##test' in the database. Both > try(db_drop_table(con, "##test"))
Error in UseMethod("db_drop_table") :
no applicable method for 'db_drop_table' applied to an object of class "c('Microsoft SQL Server', 'OdbcConnection', 'DBIConnection', 'DBIObject')"
> db_has_table(con, "##test")
Error in UseMethod("db_has_table") :
no applicable method for 'db_has_table' applied to an object of class "c('Microsoft SQL Server', 'OdbcConnection', 'DBIConnection', 'DBIObject')" However the following is a functional workaround - instead of DBI::dbRemoveTable(con, "##test") |
Using SQL Server connections, overwriting a table created by
copy_to()
withtemporary=TRUE
does not work. As a workaround, we first have to runtry(db_drop_table(con, "##test"))
between calls tocopy_to
to ensure we can overwrite the temp table.The text was updated successfully, but these errors were encountered: