Expected `dbi.attach(d, pos = 2L)` to run without any errors.
i Actually got a <simpleError> with text:
  the "RSQLite" package must be installed to use 'chinook.sqlite'

expect_type(e <- as.environment(2L), type = "environment")
expect_vector(s <- ls(e), ptype = character())
expect_warning(eval(quote(Album[, z := 42]), envir = e))
#skip_if_offline() #Borks in github Actions, adding curl package didn't help
expect_no_error(e <- dbi.attach(rna)) #works b/c only 1 schema
expect_no_error(e <- dbi.attach(rna, schema = "rnacen"))
expect_error(e <- dbi.attach(rdo)) #since not interactive / multiple schemas
expect_no_error(e <- dbi.attach(rdo, schema = "Chinook"))

#since not interactive / multiple schemas

all(unlist(eapply(e, is.dbi.table))) is not TRUE

`actual`:   FALSE
`expected`: TRUE

Error in `eval(quote(Album[, `:=`(z, 42)]), envir = e)`: object 'Album' not found

Error: the "RSQLite" package must be installed to use 'chinook.sqlite'

DBI::dbExecute(conns[[2L]], "SET threads TO 1;")
x <- merge(Album, Artist, by = "ArtistId")

Error in `(function (cond) 
.Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = "there is no package called 'RSQLite'", 
    call = loadNamespace(x), package = "RSQLite", lib.loc = NULL), class = c("packageNotFoundError", 
"error", "condition")))`: error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': there is no package called 'RSQLite'

test_that("dbi.table works on data.table help examples", {
DT <- data.table(x = rep(c("b", "a", "c"), each = 3),
DBIT <- as.dbi.table(conn, DT, type = "query")
# DT[2]                          # 2nd row
# DT[3:2]                        # 3rd and 2nd row
# DT[!2:4]                       # all rows other than 2:4
# DT[, v]                        # v column (as vector)
# DT[, sum(v)]                   # sum of column v, returned as vector
# subset rows and select|compute data.table way
# DT[2:3, sum(v)]                # sum(v) over rows 2 and 3, return vector
# DT[2:3, .(sum(v))]             # same, but return data.table with column V1
# DT[2:3, .(sv=sum(v))]          # same, but return data.table with column sv
# DT[2:5, cat(v, "\n")]          # just for j's side effect
# DT[["v"]]                      # same as DT[, v] but faster if called in a loop
# DT[, sum(v), keyby = x]              # same, but order the result on by cols
# DT[, sum(v), by = x, keyby = TRUE]   # same, but using sorting flag
DBIT[, sum(v, na.rm = TRUE), by = x][order(x)],
# fast ad hoc row subsets (subsets as joins)
# DT["a", on="x"]                # same as x == "a" but uses binary search (fast)
# DT["a", on=.(x)]               # same, for convenience, no need to quote every column
# NOTE: not optimized in dbi.table but still useful as tests
# DT[.("b", 3), on=c("x", "y")]  # join on columns x,y of DT; uses binary search (fast)
# DT[.("b", 1:2), on=c("x", "y")]             # no match returns NA
# DT[.("b", 1:2), on=.(x, y), nomatch=NULL]   # no match row is not returned
# DT[.("b", 1:2), on=c("x", "y"), roll=Inf]   # locf, nomatch row gets rolled by previous row
# DT[.("b", 1:2), on=.(x, y), roll=-Inf]      # nocb, nomatch row gets rolled by next row
# DT["b", sum(v*y), on="x"]                   # on rows where DT$x=="b", calculate sum(v*y)
# DT[x!="a", sum(v), by=x]                    # get sum(v) by "x" for each i != "a"
# DT[!"a", sum(v), by=.EACHI, on="x"]         # same, but using subsets-as-joins
# DT[c("b","c"), sum(v), by=.EACHI, on="x"]   # same
# DT[c("b","c"), sum(v), by=.EACHI, on=.(x)]  # same, using on=.()
X <- as.dbi.table(conn, X, type = "query")
# NOTE: mult and .EACHI not supported in version 1
# DT[X, on="x", mult="first"]           # first row of each group
# DT[X, on="x", mult="last"]            # last row of each group
# DT[X, sum(v), by=.EACHI, on="x"]      # join and eval j for each row in i
# DT[X, sum(v)*foo, by=.EACHI, on="x"]  # join inherited scope
# DT[X, sum(v)*i.v, by=.EACHI, on="x"]  # 'i,v' refers to X's v column
# DT[X, on=.(x, v>=v), sum(y)*foo, by=.EACHI] # NEW non-equi join with by=.EACHI (v1.9.8+)
# kDT = copy(DT)                        # (deep) copy DT to kDT to work with it.
# setkey(kDT,x)                         # set a 1-column key. No quotes, for convenience.
# setkeyv(kDT,"x")                      # same (v in setkeyv stands for vector)
# kDT["a"]                              # subset-as-join on *key* column 'x'
# kDT["a", on="x"]                      # same, being explicit using 'on=' (preferred)
# kDT[!"a", sum(v), by=.EACHI]          # get sum(v) for each i != "a"
# setkey(kDT,x,y)                       # 2-column key
# fast *keyed* subsets on multi-column key
# kDT["a"]                              # join to 1st column of key
# kDT["a", on="x"]                      # on= is optional, but is preferred
# kDT[.("a")]                           # same, .() is an alias for list()
# kDT[.("a", 3)]                        # join to 2 columns
# kDT[.("a", 3:6)]                      # join 4 rows (2 missing)
# kDT[.("a", 3:6), nomatch=NULL]        # remove missing
# kDT[.("a", 3:6), roll=TRUE]           # locf rolling join
# kDT[.("a", 3:6), roll=Inf]            # same as above
# kDT[.("a", 3:6), roll=-Inf]           # nocb rolling join
# kDT[!.("a")]                          # not join
# more on special symbols, see also ?"special-symbols"
# DT[.N]                                  # last row
expect_no_error(DBIT[, .N]) # dbi.table returns dbi.table,
# DT[, .SD, .SDcols=x:y]                  # select columns 'x' through 'y'
# DT[ , .SD, .SDcols = !x:y]              # drop columns 'x' through 'y'
# DT[ , .SD, .SDcols = patterns('^[xv]')] # select columns matching '^x' or '^v'
# DT[, .SD[1]]                            # first row of all columns
# DT[, .SD[1], by=x]                      # first row of 'y' and 'v' for each group in 'x'
# DT[, c(.N, lapply(.SD, sum)), by=x]     # get rows *and* sum columns 'v' and 'y' by group
# DT[, .I[1], by=x]                       # row number in DT corresponding to each group
# DT[, grp := .GRP, by=x]                 # add a group counter column
# DT[ , dput(.BY), by=.(x,y)]             # .BY is a list of singletons for each group
# X[, DT[.BY, y, on="x"], by=x]           # join within each group
#   # write each group to a different file
#   fwrite(.SD, file.path(tempdir(), paste0('x=', .BY$x, '.csv')))
# add/update/delete by reference (see ?assign)
# print(DT["a", v:=42L, on="x"])        # subassign to existing v column by reference
# print(DT["b", v2:=84L, on="x"])       # subassign to new column by reference (NA padded)
DBIT[, sum(v, na.rm = TRUE), by = .(y %% 2)],
DBIT[, sum(v, na.rm = TRUE), by = .(bool = y %% 2)],
# DT[, .SD[2], by = x]                    # get 2nd row of each group
# DT[, tail(.SD, 2), by = x]               # last 2 rows of each group
# DT[, lapply(.SD, sum), by = x]          # sum of all (other) columns for each group
# DT[, .SD[which.min(v)], by = x]         # nested query by group
DBIT[, list(MySum = sum(v, na.rm = TRUE),
# DT[, .(a = .(a), b = .(b)), by=x]     # list columns
# DT[, .(seq = min(a):max(b)), by=x]    # j is not limited to just aggregations
DBIT[, sum(v, na.rm = TRUE), by = x][V1 < 20],
DBIT[, sum(v, na.rm = TRUE), by = x][order(-V1)],
# DT[, c(.N, lapply(.SD, sum)), by = x]    # get number of observations and sum per group
#       }, by = x]                        # anonymous lambda in 'j', j accepts any valid
# expression. TO REMEMBER: every element of