0

My ROracle connection to Oracle 11.2g express has stopped functioning under R 4.0.4 with dbplyr_2.1.0 after an "updateR" "update.packages". The specific code is

library(dplyr)
library(dbplyr)
library(DBI)
library(ROracle)
library(tidyverse)
sql_translate_env.OraConnection <- dbplyr:::sql_translate_env.Oracle

Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : Object 'sql_translate_env.Oracle' not found

2 Answers2

1

It appears that the connection object has been renamed in the internal namespace as part of an update from your previous version to v2.1.0 (::: is used to access the internal namespace, parts of the package that are not available via the library command).

Unfortunately, changes to internal namespaces are not part of the dbplyr changelog. But here are a couple of approaches for tracking down the change:

Option one - use RStudio's autocomplete

Start typing dbplyr::: in the console and it will bring up a list of autocomplete options. You can either scroll through this or start typing an object name to see what is available. I suspect typing dbplyr:::sql_transl will be sufficient to narrow the autocomplete options to the one you need.

Option two - open the source code

You can download the source code from the package's CRAN page. This offers a tar.gz file containing the source code. With the downloaded file in your working directory untar("./dbplyr_2.1.0.tar.gz") will unpack it and let you examine the source code.

I did this and in the source file ./dbplyr/R/backend-oracle.R I find two promising looking options you could try.

  • sql_translation.Oracle on line 60
  • sql_translation.OraConnection on line 137

The most thorough way to use this approach would be to download the source code for your old version of the dbplyr package, locate the object that has been renamed, and then do a difference comparison with the source code for the current version.

Simon.S.A.
  • 6,240
  • 7
  • 22
  • 41
0

The cause is that dbplyr 2.0 no longer supports Oracle 11.2g but "Oracle translation now depends on Oracle 12c," (NEWS of 2.0 line 87). However bold source code voodoo magic appears circumvent the problem in my case:

Replace

sql_translate_env.OraConnection <- dbplyr:::sql_translate_env.Oracle

by sql_translate_env.OraConnection <- dbplyr:::sql_translation.Oracle

Replace

sql_select.OraConnection <- dbplyr:::sql_select.Oracle

by sql_select.OraConnection <- dbplyr:::sql_query_select.Oracle

Replace

sql_subquery.OraConnection <- dbplyr:::sql_subquery.Oracle

by sql_subquery.OraConnection <- dbplyr:::sql_query_wrap.Oracle

I guessed this by comparing the source of backend-Oracle.R