r-lib/pkgload

Loading DBI a second time breaks `dbConnect(RSQLite::SQLite())`

krlmlr opened this issue · 0 comments

krlmlr commented

I need a manual unloadNamespace(), before or after the second load_all(), to be actually able to use it. Should we unload all dependent namespaces when load_all() is reloading?

gert::git_clone("https://github.com/r-dbi/DBI")

pkgload::load_all("DBI")
#> ℹ Loading DBI
con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbDisconnect(con)
rm(con)

# unloadNamespace("RSQLite")

pkgload::load_all("DBI")
#> ℹ Loading DBI
dbConnect(RSQLite::SQLite(), ":memory:")
#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'dbConnect' for signature '"SQLiteDriver"'

Created on 2023-06-19 with reprex v2.0.2