simple_salesforce.bulk module

Classes for interacting with Salesforce Bulk API

class simple_salesforce.bulk.SFBulkHandler(session_id, bulk_url, proxies=None, session=None)

Bases: object

Bulk API request handler Intermediate class which allows us to use commands,

such as ‘sf.bulk.Contacts.create(...)’

This is really just a middle layer, whose sole purpose is to allow the above syntax

__init__(session_id, bulk_url, proxies=None, session=None)

Initialize the instance with the given parameters.

Arguments:

  • session_id – the session ID for authenticating to Salesforce
  • bulk_url – API endpoint set in Salesforce instance
  • proxies – the optional map of scheme to proxy server
  • session – Custom requests session, created in calling code. This
    enables the use of requests Session features not otherwise exposed by simple_salesforce.
class simple_salesforce.bulk.SFBulkType(object_name, bulk_url, headers, session)

Bases: object

Interface to Bulk/Async API functions

__init__(object_name, bulk_url, headers, session)

Initialize the instance with the given parameters.

Arguments:

  • object_name – the name of the type of SObject this represents,
    e.g. Lead or Contact
  • bulk_url – API endpoint set in Salesforce instance
  • headers – bulk API headers
  • session – Custom requests session, created in calling code. This
    enables the use of requests Session features not otherwise exposed by simple_salesforce.
delete(data)

soft delete records

hard_delete(data)

hard delete records

insert(data)

insert records

query(data)

bulk query

update(data)

update records

upsert(data, external_id_field)

upsert records based on a unique identifier