Reputation: 31
I am working on the salesforce api and came across the Bulk Upload API. I want to upload some data from a database into salesforce using the Bulk Upload API with python. I am currently using BeatBox as the library. Any pointers on how can I proceed using BeatBox? or are there ways to go about it. I have already done with half of the solution where in the data is queries from SQL and made into csv file. But how do I go about it after this for the BULK upload? Pointers would be of great help.
Upvotes: 3
Views: 3133
Reputation: 674
Found this package a few days ago:
https://pypi.python.org/pypi/salesforce-bulk/1.0.1
Seems like is what you're looking for:
from salesforce_bulk import CsvDictsAdapter
job = bulk.create_insert_job("Account", contentType='CSV')
accounts = [dict(Name="Account%d" % idx) for idx in xrange(5)]
csv_iter = CsvDictsAdapter(iter(accounts))
batch = bulk.post_bulk_batch(job, csv_iter)
bulk.wait_for_batch(job, batch)
bulk.close_job(job)
print "Done. Accounts uploaded."
Upvotes: 3
Reputation: 1811
I learned almost everything I know from this site. Really great examples:
http://tomhayden3.com/2013/08/04/salesforce-python/
http://tomhayden3.com/2013/09/05/salesforce-beatbox-multi/
Upvotes: 0