# NOT RUN {
require(ff)
##
## Example query using data in sqlite
##
require(RJDBC)
dbfile <- system.file("smalldb.sqlite3", package="ETLUtils")
drv <- JDBC(driverClass = "org.sqlite.JDBC", classPath = "/usr/local/lib/sqlite-jdbc-3.7.2.jar")
query <- "select * from testdata limit 10000"
x <- read.jdbc.ffdf(query = query,
dbConnect.args = list(drv = drv, url = sprintf("jdbc:sqlite:%s", dbfile)),
first.rows = 100, next.rows = 1000, VERBOSE=TRUE)
write.jdbc.ffdf(x = x, name = "helloworld", row.names = FALSE, overwrite = TRUE,
dbConnect.args = list(drv = drv, url = sprintf("jdbc:sqlite:%s", dbfile)),
by = 1000, VERBOSE=TRUE)
test <- read.jdbc.ffdf(query = "select * from helloworld",
dbConnect.args = list(drv = drv, url = sprintf("jdbc:sqlite:%s", dbfile)))
# }
Run the code above in your browser using DataLab