Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions Readme → Readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
Bulk API implementation in Python
Salesforce Bulk API Demo with Python
====================================

Cloudspokes Challenge : http://www.cloudspokes.com/challenges/1857
Cloudspokes Challenge :
-----------------------
http://www.cloudspokes.com/challenges/1857

Requirement:
------------
The application will demonstrate how to create, read, update and delete records in Salesforce.com in bulk using the Bulk API.

For login and logout operation, utilizing the Beatbox library from https://github.com/superfell/Beatbox
###For login and logout operation, utilizing the Beatbox library from
<https://github.com/superfell/Beatbox>

###How to Run :
$ python crudtest.py

###Video Instruction :
<http://www.screencast.com/t/00cYnKLB> -- showing how to use CUD operation

<http://www.screencast.com/t/oJxfheP9dv6> -- show how to do bulk query

How to Run :
$ python crudtest.py

Instructions to do CRUD Operation
=================================

(C)reate Operation:
##(C)reate Operation:
``` python
# initate login
obb = sfBulk();
obb.login(username, password)
Expand All @@ -32,10 +45,10 @@ Instructions to do CRUD Operation
batchIds = obb.createBatchFromCSV(jobinfo, "insert_csv.txt")
# close the job
obb.closeJob(jobinfo)
# logout
obb.logout()
```

(U)pdate Operation:
##(U)pdate Operation:
```python
obb = sfBulk();
obb.login(username, password)
jobinfo = sfBulkJobInfo()
Expand All @@ -45,9 +58,10 @@ Instructions to do CRUD Operation
obb.createJob(jobinfo)
batchIds = obb.createBatchFromCSV(jobinfo, "update_csv.txt")
obb.closeJob(jobinfo)
obb.logout()
```

(D)elete Operation:
##(D)elete Operation:
```python
obb = sfBulk();
obb.login(username, password)
jobinfo = sfBulkJobInfo()
Expand All @@ -57,9 +71,10 @@ Instructions to do CRUD Operation
obb.createJob(jobinfo)
batchIds = obb.createBatchFromCSV(jobinfo, "delete_csv.txt")
obb.closeJob(jobinfo)
obb.logout()
```

(R)ead / Query Operation:
##(R)ead / Query Operation:
```python
obb = sfBulk();
obb.login(username, password)
jobinfo = sfBulkJobInfo()
Expand All @@ -71,10 +86,11 @@ Instructions to do CRUD Operation
# you can also use SOQL directly using
# batchId = obb.createBatch(jobInfo, "Select id, name from Account")
obb.closeJob(jobinfo)
obb.logout()
```

Another operation included in the library:
* Ability to find batch status, Example during query
##Another operation included in the library:
* Ability to find batch status, Example during query
```python
obb = sfBulk();
obb.login(username, password)
jobinfo = sfBulkJobInfo()
Expand All @@ -94,6 +110,5 @@ Another operation included in the library:
pprint(obb.showBatchResult(jobinfo, batchIds[0]))

obb.closeJob(jobinfo)
obb.logout()

```

5 changes: 1 addition & 4 deletions crudtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,5 @@
pprint(obb.showBatchResult(jobinfo, batchId))

# close the job
obb.closeJob(jobinfo)
# logout completely
obb.logout()

obb.closeJob(jobinfo)

7 changes: 3 additions & 4 deletions delete_csv.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
id
001E000000Q1aT3IAJ
001E000000Q1aT4IAJ
001E000000Q1aT5IAJ
001E000000Q1aT6IAJ
001E000000Q1art
001E000000Q1as3
001E000000Q1as4
Loading