Skip to content

Commit

Permalink
dbFetchArrowChunk
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 25, 2023
1 parent f335521 commit 2fc961d
Show file tree
Hide file tree
Showing 25 changed files with 200 additions and 5 deletions.
1 change: 1 addition & 0 deletions R/dbFetchArrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' `r lifecycle::badge('experimental')`
#'
#' Fetch the result set and return it as an Arrow object.
#' Use [dbFetchArrowChunk()] to fetch results in chunks.
#'
#' @inheritSection dbBind The data retrieval flow for Arrow streams
#'
Expand Down
40 changes: 39 additions & 1 deletion R/dbFetchArrowChunk.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
#' @rdname dbFetch
#' Fetch the next batch of records from a previously executed query as an Arrow object
#'
#' @description
#' `r lifecycle::badge('experimental')`
#'
#' Fetch the next chunk of the result set and return it as an Arrow object.
#' The chunk size is implementation-specific.
#' Use [dbFetchArrow()] to fetch all results.
#'
#' @inheritSection dbBind The data retrieval flow for Arrow streams
#'
#' @template methods
#' @templateVar method_name dbFetchArrowChunk
#'
#' @inherit DBItest::spec_arrow_fetch_arrow_chunk return
#' @inheritSection DBItest::spec_arrow_fetch_arrow_chunk Failure modes
#' @inheritSection DBItest::spec_arrow_fetch_arrow_chunk Specification
#'
#' @param res An object inheriting from [DBIResultArrow-class], created by
#' [dbSendQueryArrow()].
#' @param ... Other arguments passed on to methods.
#' @seealso Close the result set with [dbClearResult()] as soon as you
#' finish retrieving the records you want.
#' @family DBIResult generics
#' @family data retrieval generics
#' @export
#' @examplesIf requireNamespace("RSQLite", quietly = TRUE) && requireNamespace("nanoarrow", quietly = TRUE)
#' con <- dbConnect(RSQLite::SQLite(), ":memory:")
#'
#' dbWriteTable(con, "mtcars", mtcars)
#'
#' # Fetch all results
#' rs <- dbSendQueryArrow(con, "SELECT * FROM mtcars WHERE cyl = 4")
#' dbHasCompleted(rs)
#' as.data.frame(dbFetchArrowChunk(rs))
#' dbHasCompleted(rs)
#' as.data.frame(dbFetchArrowChunk(rs))
#' dbClearResult(rs)
#'
#' dbDisconnect(con)
setGeneric("dbFetchArrowChunk",
def = function(res, ...) standardGeneric("dbFetchArrowChunk")
)
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ reference:
- dbSendQueryArrow
- dbBindArrow
- dbFetchArrow
- dbFetchArrowChunk

- title: Classes
desc: S4 classes defined by DBI.
Expand Down
1 change: 1 addition & 0 deletions man/DBIResult-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/dbBind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/dbClearResult.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbColumnInfo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions man/dbFetch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/dbFetchArrow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 131 additions & 0 deletions man/dbFetchArrowChunk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetInfo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetQuery.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetQueryArrow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetRowCount.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetRowsAffected.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbGetStatement.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/dbHasCompleted.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbIsReadOnly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbIsValid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbQuoteIdentifier.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/dbQuoteLiteral.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2fc961d

Please sign in to comment.