-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Line 87 in 5726930
| subclass <- class(src$con)[[1]] # prefix added by dplyr::make_tbl |
We have a DBIConnection class that inherits from a virtual class:
is(con)
# [1] "MyDBIConnection" "VirtualDBIConnection" "DBIConnection" "DBIObject"We had to write a tbl.MyDBIConnection in order to get the desired class structure of the output:
tbl.MyDBIConnection <- function(src, from, ...) {
dbi_src <- src_dbi(src, auto_disconnect = FALSE)
tbl <- tbl_sql(c("MyDBIConnection", "VirtualDBIConnection", "dbi"), src = dbi_src, from = from, ...)
return(tbl)
}It seems we could instead try to do this automatically:
tbl.src_dbi <- function(src, from, ...) {
inheritance <- is(src$con)
subclass <- head(inherits, match("DBIConnection", inheritance)-1L) # prefix added by dplyr::make_tbl
tbl_sql(c(subclass, "dbi"), src = src, from = from, ...)
}However I'm not sure the broader implications of this (do we require src$con to be S4? do we require it to inherit from DBIConnection?)
Metadata
Metadata
Assignees
Labels
No labels