dbFetch_AdbiResult | R Documentation |
When fetching results using DBI::dbFetch()
, the argument n
can be
specified to control chunk size per fetching operation. The default value of
-1
corresponds to retrieving the entire result set at once, while a
positive integer will try returning as many rows (as long as n
does not
exceed the available number of rows), in line with standard DBI
expectations. As data transfer is mediated by Arrow data structures, which
are retrieved as array chunks, the underlying chunk size can be used by
passing an n
value NA
.
## S4 method for signature 'AdbiResult'
dbFetch(res, n = -1, ...)
res |
An object inheriting from DBI::DBIResult,
created by |
n |
maximum number of records to retrieve per fetch. Use |
... |
Other arguments passed on to methods. |
A data.frame
with the requested number of rows (or zero rows if
DBI::dbFetch()
is called on a result set with no more remaining rows).
if (requireNamespace("adbcsqlite")) {
library(DBI)
con <- dbConnect(adbi::adbi("adbcsqlite"), uri = ":memory:")
dbWriteTable(con, "swiss", swiss)
res <- dbSendQuery(con, "SELECT * from swiss WHERE Agriculture < 30")
dbFetch(res)
dbClearResult(res)
dbDisconnect(con)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.