Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from salesforce_bulk import SalesforceBulk
- bulk = SalesforceBulk(username=“xxxxxx@xxxx.com", password=“xxxxxxxxx”, security_token=“xxxxxxxxxxxxxxxxxxxxxx”)
- # Create a new job
- job = bulk.create_query_job("Contact", contentType='JSON')
- # Add one or more batches to the job
- batch = bulk.query(job, "select Id,LastName, LastModifiedDate, SystemModstamp from Contact where SystemModstamp < LAST_N_DAYS:20")
- # Close the job
- bulk.close_job(job)
- # Wait for each batch to finish
- while not bulk.is_batch_done(batch):
- time.sleep(10)
- results = []
- for result in bulk.get_all_results_for_query_batch(batch):
- results.append(json.load(IteratorBytesIO(result)))
- for row in results:
- print(row)
- {'attributes': {'type': 'Contact', 'url':
- '/services/data/v40.0/sobjects/Contact/0034400001sdfeIaAAI'}, 'Id':
- '0034400001sdfeIaAAI', 'LastName': 'obrien', 'LastModifiedDate':
- 1539024446000, 'SystemModstamp': 1539024446000}
Add Comment
Please, Sign In to add comment