Intermediate Importing Data in R
Filip Schouwenaars
Instructor, DataCamp
dbGetQuery(con, "SELECT * FROM products
WHERE contract = 1")
id name contract
1 2 Call Plus 1
2 9 Biz Unlimited 1
res <- dbSendQuery(con, "SELECT * FROM products WHERE contract = 1")
dbFetch(res)
id name contract
1 2 Call Plus 1
2 9 Biz Unlimited 1
dbClearResult(res)
TRUE
res <- dbSendQuery(con, "SELECT * FROM products WHERE contract = 1")
while(!dbHasCompleted(res)) { + chunk <- dbFetch(res, n = 1) + print(chunk) + }
id name contract
1 2 Call Plus 1
id name contract
1 9 Biz Unlimited 1
id name contract
<0 rows> (or 0-length row.names)
dbClearResult(res)
TRUE
dbDisconnect(con)
TRUE
Intermediate Importing Data in R