library(dplyr)
tmp <- tempfile(fileext = ".sqlite3")
db <- src_sqlite(tmp, create = TRUE)
copy_to(db, mtcars, "mt_cars")
mt_cars <- tbl(db, "mt_cars") %>% top_n(20)
mt_cars
#> Error in sqliteSendQuery(con, statement, bind.data) :
#> error in statement: near "DESC": syntax error
This error seems to be the result of a bad WHERE clause
mt_cars$query
#> <Query> SELECT "mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"
#> FROM "mt_cars"
#> WHERE MIN_RANK("carb" DESC) <= 20.0
#> <SQLiteConnection>
This error seems to be the result of a bad WHERE clause