Issue dbplyr, Combining tbl(), in_schema(), and purrr:::map

Hi Guys,
I was trying to pull several tables using a combination of purrr::map and the dbplyr framework, but I´m getting this error:

library(tidyverse, warn=FALSE)
library(glue,, warn=FALSE)
library(dbplyr,, warn=FALSE)
mes <- c("04","05","06","07","08","09","10","11")
BASE_AC <- glue("BASE_AC_2019{mes}") %>%
  map(~ tbl(in_schema("dl_cm_bi", .x)) %>% collect)
#> Error in UseMethod("tbl"): no applicable method for 'tbl' applied to an object of class "c('ident_q', 'ident', 'character')"

Created on 2019-11-25 by the reprex package (v0.3.0)

I´m trying with glue to create several table names and then parse that into in_schema() and tbl() to collect the different tables into one single list.

Of course this reprex is not 100% reproducible because I need to connect to my database but at least I wanted to show the kind of error I´m getting.

Any help will be deeply appreciated.

Thanks,

Alfonso

Brrrp... I din´t add the connection object to tbl(). Thanks anyway

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.