sf_query_bulk_v2 {salesforcer}R Documentation

Run Bulk 2.0 query

Description

This function is a convenience wrapper for submitting and retrieving query API jobs from the Bulk 2.0 API.

Usage

sf_query_bulk_v2(
  soql,
  object_name = NULL,
  queryall = FALSE,
  guess_types = TRUE,
  bind_using_character_cols = deprecated(),
  interval_seconds = 3,
  max_attempts = 200,
  control = list(...),
  ...,
  api_type = "Bulk 2.0",
  verbose = FALSE
)

Arguments

soql

character; a string defining a SOQL query (e.g. "SELECT Id, Name FROM Account").

object_name

character; the name of the Salesforce object that the function is operating against (e.g. "Account", "Contact", "CustomObject__c").

queryall

logical; indicating if the query recordset should include records that have been deleted because of a merge or delete. Setting this argument to TRUE will also return information about archived Task and Event records. It is available in API versions 29.0 and later.

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.

interval_seconds

integer; defines the seconds between attempts to check for job completion.

max_attempts

integer; defines then max number attempts to check for job completion before stopping.

control

list; a list of parameters for controlling the behavior of the API call being used. For more information of what parameters are available look at the documentation for sf_control.

...

other arguments passed on to sf_control or sf_create_job_bulk to specify the content_type, concurrency_mode, and/or column_delimiter.

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

A tbl_df of the recordset returned by the query

References

Bulk 2.0 documentation

Examples

## Not run: 
# select all Ids from Account object (up to 1000)
ids <- sf_query_bulk_v2(soql = 'SELECT Id FROM Account LIMIT 1000', 
                        object_name = 'Account')
# alternatively you can specify as 
ids <- sf_query(soql = 'SELECT Id FROM Account LIMIT 1000', 
                object_name = 'Account', 
                api_type="Bulk 2.0")

## End(Not run)

[Package salesforcer version 1.0.1 Index]