oracle-databasedbplyrroracle

Object 'sql_translate_env.Oracle' not found


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


Solution

  • 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.

    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.