OHDSI / Andromeda

AsynchroNous Disk-based Representation of MassivE DAta: An R package aimed at replacing ff for storing large data objects.
https://ohdsi.github.io/Andromeda/
11 stars 10 forks source link

“SQLiteConnection” error when loading plpData object #9

Closed lhjohn closed 3 years ago

lhjohn commented 3 years ago

Using: R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" Platform: x86_64-apple-darwin17.0 (64-bit)

Reproduce: I was successfully loading plpData objects using plpData <- PatientLevelPrediction::loadPlpData([...]) . Then I decided to update all my R packages (08-02-2021 at 11 UTC). One update must have broken the plpData objects loading. I now get the following error.

Error in initialize(value, ...) : 
  invalid name for slot of class “SQLiteConnection”: extended_types

Can anyone reproduce this?

schuemie commented 3 years ago

Yes, this is a known issue. Please see this post

ablack3 commented 3 years ago

Reposting Martijn's explanation here and closing the issue. Reopen if the solution below isn’t working.

Technical explanation: The reason why this appears to be happening is because the latest version of RSQLite has added a field to the SQLiteConnection class. Multiple classes in HADES inherit from this class, and we discovered R has a weird habit of caching class definitions when installing packages. That means for example that the FeatureExtraction package, once installed, maintains a copy of the SQLiteConnection class definition. When the SQLiteConnection class is updated, for example because the new version of RSQLite is installed, the new and the cached version are out of sync, causing the error.

Solution: when the packages are reinstalled, the cache is recreated. So, after updating RSQLite, when this error starts to appear, reinstall those packages that introduce classes that inherit from SQLiteConnection:

# Uninstall the packages:
remove.packages(c("FeatureExtraction", "CohortMethod", "SelfControlledCaseSeries"))

# Reinstall the packages (remove any that you don't need):
remotes::install_github("ohdsi/FeatureExtraction")
remotes::install_github("ohdsi/CohortMethod")
remotes::install_github("ohdsi/SelfControlledCaseSeries")