Skip to contents

This function returns the recordset of a bulk query which has already been submitted to the Bulk 1.0 or Bulk 2.0 API and has completed.

Usage

sf_query_result_bulk(
  job_id,
  batch_id = NULL,
  result_id = NULL,
  guess_types = TRUE,
  bind_using_character_cols = deprecated(),
  batch_size = 50000,
  api_type = c("Bulk 1.0", "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".

batch_id

character; the Salesforce Id assigned to a submitted batch as returned by sf_create_batches_bulk. It will start with "751".

result_id

character; a string returned from sf_batch_details_bulk when a query has completed and specifies how to get the recordset

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 along with anytime() and anydate(). If FALSE then all fields will be returned as character. Specifying FALSE helpful when guessing the column data type will result in NA values and you would like to return the results as strings and then cast in your script according to your unique specifications.

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).

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

Examples

if (FALSE) { # \dontrun{
my_query <- "SELECT Id, Name FROM Account LIMIT 1000"
job_info <- sf_create_job_bulk(operation = 'query', object = 'Account')
query_info <- sf_submit_query_bulk(job_id = job_info$id, soql = my_query)
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)
} # }