sf_query_result_bulk_v2: Retrieve the results of a Bulk 2.0 query

View source: R/bulk-query.R

sf_query_result_bulk_v2R Documentation

Retrieve the results of a Bulk 2.0 query

Description

This function returns the row-level recordset of a Bulk 2.0 query which has already been submitted as a Bulk 2.0 API job and has a JobComplete state.

Usage

sf_query_result_bulk_v2(
  job_id,
  guess_types = TRUE,
  bind_using_character_cols = deprecated(),
  batch_size = 50000,
  locator = NULL,
  api_type = c("Bulk 2.0"),
  verbose = FALSE
)

Arguments

job_id

character; the Salesforce Id assigned to a submitted job as returned by sf_create_job_bulk. It will start with "750".

guess_types

logical; indicating whether or not to use col_guess() to try and cast the data returned in the recordset. If TRUE then col_guess() is used, if FALSE then all fields will be returned as character. This is helpful when col_guess() will mangle field values in Salesforce that you'd like to preserve during translation into a tbl_df, like numeric looking values that must be preserved as strings ("48.0").

bind_using_character_cols

logical; an indicator of whether to cast the data to all character columns to ensure that bind_rows does not fail because two paginated recordsets have differing datatypes for the same column. Set this to TRUE rarely, typically only when having this set to FALSE returns an error or you want all columns in the data to be character.

batch_size

integer; the number of individual records to be included in a single batch uploaded to the Bulk APIs (1.0 or 2.0).

locator

character; a string returned found in the API response header of a prior iteration of sf_query_result_bulk_v2 that is included in the query string of the next call to paginate through all records returned by the query.

api_type

character; one of "REST", "SOAP", "Bulk 1.0", or "Bulk 2.0" indicating which API to use when making the request.

verbose

logical; an indicator of whether to print additional detail for each API call, which is useful for debugging. More specifically, when set to TRUE the URL, header, and body will be printed for each request, along with additional diagnostic information where available.

Value

tbl_df, formatted by Salesforce, containing query results

References

Bulk 2.0 documentation

Examples

## Not run: 
my_query <- "SELECT Id, Name FROM Account LIMIT 1000"
job_info <- sf_create_job_bulk(operation = 'query', object = 'Account', api_type="Bulk 2.0")
query_info <- sf_submit_query_bulk(job_id = job_info$id, soql = my_query, api_type="Bulk 2.0")
result <- sf_batch_details_bulk(job_id = query_info$jobId,
                                batch_id = query_info$id)
recordset <- sf_query_result_bulk(job_id = query_info$jobId,
                                  batch_id = query_info$id,
                                  result_id = result$result)
sf_close_job_bulk(job_info$id, api_type="Bulk 2.0")

## End(Not run)

salesforcer documentation built on March 18, 2022, 6:26 p.m.