rrjdbc

dbWriteTable function in DBI package is throwing an error


I am trying to use dbWriteTable function in DBI package to upload a dataframe to presto server. It is throwing the following error:

"Error in .verify.JDBC.result(r, "Unable to retrieve JDBC tables list") : Unable to retrieve JDBC tables list ()"

I have also tried using insert into, create, drop commands in dbSendQuery with the same connection and it is working perfectly. I am facing issue when I use dbWriteTable function.

I have tried other functions of the DBI package like dbReadTable, dbCreateTable too which is working perfectly for me

Code:

dbWriteTable(conn,DBI::SQL("test.demo"),value =  df)

Solution

  • I guess the problem is dbListTables(). The error probably comes from here:

    https://github.com/s-u/RJDBC/blob/1a4fa8558bd20b5a6adbdd6588aa1f61bd51d7d7/R/class.R#L273 https://github.com/s-u/RJDBC/blob/1a4fa8558bd20b5a6adbdd6588aa1f61bd51d7d7/R/class.R#L183

    Does this succeed?

    dbListTables(conn, pattern = DBI::SQL("test.demo"))
    

    If don't, maybe you don't have permission to read metadata, or something is wrong with your JDBC driver.

    (I also recommend RPresto if it works. But, I know it's not always the case...)