I have the same problems:
Select all rows once:
df = dbFetch(res, n = -1)
=> it returns only part of the result set and stops retrieving more rows.
Using a loop to extract fragments:
while (! dbHasCompleted (res)) {
chunk = dbFetch (res, n = 1000)
print (nrow (chunk))
df = rbind (df, chunk)
}
=> it returned some pieces for a while, and then runs into an endless loop of zero size (print " [1] 0 " forever), even if the result set did not complete the selection of all rows: dbHasCompleted(res) == FALSE .
Then I used this strategy:
Run the query with " select count(1) from table where ... " to find out the size of the result set. Added 1 to the number of row counters [ row_count = as.integer(dbFetch(res, n = 1)) + 1 ] and use this parameter "count + 1" as parameter n to immediately get all the rows in the next query. Everything seems to be in order so far ... but then I knew about this form:
my_df = dbGetQuery(con, my_query)
Much better method, no errors yet.
source share