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

No applicable method for db_has_table #563

Closed
andrew-schulman opened this issue Dec 16, 2020 · 2 comments
Closed

No applicable method for db_has_table #563

andrew-schulman opened this issue Dec 16, 2020 · 2 comments

Comments

@andrew-schulman
Copy link

In dbplyr 2.0.0 with dplyr 1.0.2, db_has_table causes a no applicable method for 'db_has_table' error. It seems that db_has_table is no longer implemented, although it's still listed in the dplyr documentation. I hope it's going to be added back in?

With an ODBC back end:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
dbpool <- pool::dbPool(odbc::odbc(), ...)
db_has_table(dbpool, 'table_name')
#> Error in UseMethod("db_has_table"): no applicable method for 'db_has_table' applied to an object of class "c('Oracle', 'OdbcConnection', 'DBIConnection', 'DBIObject')"

With a Postgres back end:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
dbpool <- pool::dbPool(RPostgres::Postgres(), ...)
db_has_table(dbpool, 'table_name')
#> Error in UseMethod("db_has_table"): no applicable method for 'db_has_table' applied to an object of class "c('PqConnection', 'DBIConnection', 'DBIObject')"

Both of the above used to work in dbplyr 1.x.

@andrew-schulman
Copy link
Author

andrew-schulman commented Dec 16, 2020

I see also the same error for db_create_table, db_drop_table, and db_list_tables.

@Alternikaner
Copy link

Alternikaner commented Dec 17, 2020

The release notes for the latest version (under "Extensibility") mention a change involving these generics since db_write_table() no longer requires them.

DBI::dbExistsTable() should work as a drop-in replacement for db_has_table().
DBI also provides equivalents for your other use cases in dbCreateTable(), dbRemoveTable() and dbListTables() respectively.

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

3 participants