You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When table_names is supplied to dm_from_con(), an error is thrown due to attempting to use the @ operator on a character vector. I think this changed to accomodate the new .names argument (#1790). It seems as though @owenjonesuob has already submitted a PR (#1934) to fix a different issue resulting from this; I think this should also fix the issue I'm documenting. Reprex for issue is below.
library(dm)
#> Warning: package 'dm' was built under R version 4.3.1#> #> Attaching package: 'dm'#> The following object is masked from 'package:stats':#> #> filter
library(nycflights13)
#> Warning: package 'nycflights13' was built under R version 4.3.1# Create in-memory SQLite databasedm<- dm_nycflights13()
con_sqlite<-DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_dm_to(con_sqlite, dm)
# Run `dm_from_con()` w/o `table_names` (set `learn_keys = FALSE` to avoid warnings)
dm_from_con(con_sqlite, learn_keys=FALSE)
#> ── Table source ────────────────────────────────────────────────────────────────#> src: sqlite 3.41.2 [:memory:]#> ── Metadata ────────────────────────────────────────────────────────────────────#> Tables: `airlines_1_2023_08_02_11_10_57_425818_20696`, `airports_1_2023_08_02_11_10_57_425818_20696`, `flights_1_2023_08_02_11_10_57_425818_20696`, `planes_1_2023_08_02_11_10_57_425818_20696`, `weather_1_2023_08_02_11_10_57_425818_20696`#> Columns: 53#> Primary keys: 0#> Foreign keys: 0# Run `dm_from_con()` w/ `table_nms` - throws errortbl_nms<-DBI::dbListTables(con_sqlite)
dm_from_con(con_sqlite, learn_keys=FALSE, table_names=tbl_nms)
#> Error in `purrr::map_chr()`:#> ℹ In index: 1.#> Caused by error in `.x@name`:#> ! no applicable method for `@` applied to an object of class "character"#> Backtrace:#> ▆#> 1. ├─dm::dm_from_con(con_sqlite, learn_keys = FALSE, table_names = tbl_nms)#> 2. │ └─purrr::map_chr(src_tbl_names, ~.x@name[["table"]])#> 3. │ └─purrr:::map_("character", .x, .f, ..., .progress = .progress)#> 4. │ ├─purrr:::with_indexed_errors(...)#> 5. │ │ └─base::withCallingHandlers(...)#> 6. │ ├─purrr:::call_with_cleanup(...)#> 7. │ └─dm (local) .f(.x[[i]], ...)#> 8. └─base::.handleSimpleError(...)#> 9. └─purrr (local) h(simpleError(msg, call))#> 10. └─cli::cli_abort(...)#> 11. └─rlang::abort(...)# CleanupDBI::dbDisconnect(con_sqlite)
rm(con_sqlite, dm, tbl_nms)
gc()
#> used (Mb) gc trigger (Mb) max used (Mb)#> Ncells 1286024 68.7 2531651 135.3 2531651 135.3#> Vcells 2324009 17.8 8388608 64.0 2981620 22.8
When
table_names
is supplied todm_from_con()
, an error is thrown due to attempting to use the@
operator on acharacter
vector. I think this changed to accomodate the new.names
argument (#1790). It seems as though @owenjonesuob has already submitted a PR (#1934) to fix a different issue resulting from this; I think this should also fix the issue I'm documenting. Reprex for issue is below.Created on 2023-08-02 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: