sf_query_result_bulk: Retrieve the results of a completed bulk query

View source: R/bulk-query.R

sf_query_result_bulkR Documentation

Retrieve the results of a completed bulk query

Description

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

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 1.0 documentation and 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')
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)

## End(Not run)

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