Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
version 47.0

Bulk API 2.0

Built up a python script using requests and requests_oathlib modules against test.salesforce.com/services/oauth2/token to generate access tokens

and a function that concatenates chunks of results until last chunk is detected then creates a json string from the results.

we know we have 1479552 rows in Contact.

Problem: 

SELECT id,Name,Email,Phone FROM Contact LIMIT 1850000

returns all 1479552 rows but

SELECT id,Name,Email,Phone FROM Contact

returns only 492196 !!!

What is up with that??!!??

And I noticed that when using the LIMIT clause, only two chunks are returned, the first one contains all or close to all the data and the second only 110 bytes or so, while without the LIMIT  3 chunks of roughly equal size are returned.

Can anyone verify and/or explain this behaviour? Better still, tell me how to get around it?

First post, YAY!

TIA,

Chris

 
2 answers
  1. Apr 13, 2020, 4:42 PM
    Hello Swetha,

    I found the problem was not with SF but with the way my code was calling sequential chunks of output - it was -appending-  location values onto the submitted URL upon each loop iteration so of course only worked correctly on the first loop. Changing the appending to a simple reforming with 

             

    url_full = "{0}/jobs/query/{1}/results?locator={2}".format( url_to_use, operation_id, header_dict['Sforce-Locator'])

    did the trick.

    Thx,

    Chris
Loading
0/9000