1

Is there some way to get Bulk API Job Id in job results?

object_type = self.sf_connection.bulk.__getattr__('Case')
results = objecttype._bulk_operation(use_serial = True, operation = 'delete', data = db_dict_list, batch_size = 10000)

The results here doesn't return job id. Is there a way to get job id?

1 Answer 1

1

You can use salesforce-bulk package instead.

Eg:

from time import sleep

from salesforce_bulk import SalesforceBulk


def startBulkAPI():
    bulk = SalesforceBulk(sessionId="00D0k0000009cvA!*****CAdVT8datyhmWPhDr5yIOSt.NxQWgu6I_XIuD", host="https://*****.my.salesforce.com")
    job = bulk.create_query_job("Task", contentType='CSV')
    batch = bulk.query(job, "select Id from Task WHERE CreatedDate = LAST_N_MONTHS:6")
    bulk.close_job(job)
    while not bulk.is_batch_done(batch):
        sleep(10)


if __name__ == '__main__':
    startBulkAPI()

Here job gives back the job Id, and batch will give each batch id (chunking batch id)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .