{ "info": { "author": "Shreyans Sheth", "author_email": "dev.shreyans96@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "Salesforce Bulkipy\n==================\n\nA Python library for the Salesforce Bulk API (that actually works)\n\nChanges over `salesforce-bulk `__\n----------------------------------------------------------------------------\n\nThe `salesforce-bulk `__\nlibrary was used to export 18k records to\n`Wingify `__'s Salesforce system. Even\nthough the library was super useful, it's broken, not maintained anymore\nand was a pain to work with while figuring out the bugs.\n[@bholagabbar](https://github.com/bholagabbar) decided to fix all the\nissues faced and release a new, usable library\n`**salesforce-bulkipy** `__.\nThis library has been tested successfully on our Salesforce Sandbox.\n\n- Added support for `Two-Factor\n Authentication `__\n by routing authentication via\n `simple-salesforce `__\n- Added support for `Salesforce\n Sandbox `__\n- Added support for parsing unicode characters in CSV\n- Explicit\n `Upsert `__\n Support\n- Fixed various other bugs\n\n**salesforce-bulkipy** will be actively maintained, unlike\nsalesforce-bulk\n\nInstallation\n------------\n\n**``sudo pip install salesforce-bulkipy``**\n\nIncase your setup fails, you may have a few essential tools missing. Try\n``sudo apt-get install build-essential libssl-dev libffi-dev python-dev``\n\nAuthentication\n--------------\n\nTo access the Bulk API, you need to authenticate a user into Salesforce.\nThere are 2 possible ways to achieve this. These methods work\nirrespective of whether your organisation has `Two-Factor\nAuthentication `__\nenabled or not, so that's a massive overhead taken care of.\n\nThe code samples shown read credentials from a `config.properties `__ file. Feel free to adapt the input method to your setting\n''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\n\n1. username, password, `security\\_token `__\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n from salesforce_bulkipy import SalesforceBulkipy\n import ConfigParser\n\n config = ConfigParser.RawConfigParser()\n config.read('config.properties')\n\n username = config.get('Section', 'username')\n password = config.get('Section', 'password')\n security_token = config.get('Section', 'security_token')\n\n bulk = SalesforceBulkipy(username=username, password=password, security_token=security_token) #optional parameter: sandbox=True\n\n # Authentication Successful!\n\n2. session\\_id, host\n^^^^^^^^^^^^^^^^^^^^\n\n::\n\n from salesforce_bulkipy import SalesforceBulkipy\n import ConfigParser\n\n config = ConfigParser.RawConfigParser()\n config.read('config.properties')\n\n session_id = config.get('Section', 'session_id')\n session_id = config.get('Section', 'session_id')\n\n bulk = SalesforceBulkipy(session_id=session_id, host=host) #optional parameter: sandbox=True\n\n # Authentication Successful!\n\nOperations\n----------\n\nThe basic sequence for driving the Bulk API is:\n\n1. Create a new job\n2. Add one or more batches to the job\n3. Wait for each batch to finish\n4. Close the job\n\nBulk Insert, Update, Upsert, Delete\n-----------------------------------\n\nAll Bulk upload operations work the same. You set the operation when you\ncreate the job. Then you submit one or more documents that specify\nrecords with columns to *insert*/*update*/*delete*.\n\nFor the *upsert* operation, we also need to specify some thing called\nthe *external\\_key* which can be any attribute(preferably unique) of\nyour custom Salesforce object. Every record to upsert is checked against\nthis key in Salesforce. Say your external key is *Id*. Now for every\nrecord you are pushing, it is checked it you have a record with the same\n*Id* already. If yes, then it is updated else that record is created.\n\nFor the *delete* operation, you should only submit the Id for each\nrecord.\n\nFor efficiency you should use the ``post_bulk_batch`` method to post\neach batch of data. (Note that a batch can have a maximum 10,000 records\nand be 1GB in size.) You pass a generator or iterator into this function\nand it will stream data via POST to Salesforce. For help sending CSV\nformatted data you can use the salesforce\\_bulk.CsvDictsAdapter class.\nIt takes an iterator returning dictionaries and returns an iterator\nwhich produces CSV data.\n\n**Concurrency mode**: When creating the job, you can pass\n``concurrency=Serial`` or ``concurrency=Parallel`` to set the\nconcurrency mode for the job.\n\nBulk Insert Example\n-------------------\n\n::\n\n from salesforce_bulkipy import SalesforceBulkipy\n from salesforce_bulkipy import CsvDictsAdapter\n\n bulk = SalesforceBulkipy(username=username, password=password, security_token=security_token)\n\n records_to_insert = [{}, {}] # A list of A Custom Object dict\n\n # Bulk Insert\n job = bulk.create_insert_job(\"CustomObjectName\", contentType='CSV')\n csv_iter = CsvDictsAdapter(iter(records_to_insert))\n batch = bulk.post_bulk_batch(job, csv_iter)\n bulk.wait_for_batch(job, batch)\n bulk.close_job(job)\n\nBulk Query Example\n------------------\n\n::\n\n from salesforce_bulkipy import SalesforceBulkipy\n\n bulk = SalesforceBulkipy(username=username, password=password, security_token=security_token)\n\n records_to_insert = [{}, {}] # A list of A Custom Object dict\n\n # Bulk Query\n query = '' # SOQL Query\n job = bulk.create_query_job(\"Object_Name\", contentType='CSV')\n batch = bulk.query(job, query)\n bulk.wait_for_batch(job, batch)\n bulk.close_job(job)\n # Result\n results = bulk.get_batch_result_iter(job, batch, parse_csv=True)\n\nBulk Upsert Example\n-------------------\n\n::\n\n from salesforce_bulkipy import SalesforceBulkipy\n\n bulk = SalesforceBulkipy(username=username, password=password, security_token=security_token)\n\n records_to_upsert = [{}, {}] # A list of A Custom Object dict\n\n # Bulk Query\n query = '' # SOQL Query\n job = bulk.create_upsert_job(\"Object_Name\", external_id_name=\"Unique_id\", contentType='CSV')\n csv_iter = CsvDictsAdapter(iter(records_to_insert))\n batch = bulk.post_bulk_batch(job, csv_iter)\n bulk.wait_for_batch(job, batch)\n bulk.close_job(job)\n\nCredits and Contributions\n-------------------------\n\nThis repository is a maintained fork of\n`heroku/salesforce-bulk `__.\nThe changes incorporated here are a result of a joint effort by\n[@lambacck](https://github.com/lambacck),\n[@Jeremydavisvt](https://github.com/Jeremydavisvt),\n[@alexhughson](https://github.com/alexhughson) and\n[@bholagabbar](https://github.com/bholagabbar). Thanks to\n[@heroku](https://github.com/heroku) for creating the original useful\nlibrary.\n\nFeel free to contribute by creating Issues and Pull Requests. We'll test\nand merge them.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wingify/salesforce-bulkipy", "keywords": null, "license": "Copyright (c) 2016 Shreyans Sheth\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "salesforce-bulkipy", "package_url": "https://pypi.org/project/salesforce-bulkipy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/salesforce-bulkipy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/wingify/salesforce-bulkipy" }, "release_url": "https://pypi.org/project/salesforce-bulkipy/1.0/", "requires_dist": null, "requires_python": null, "summary": "A Python library for the Salesforce Bulk API", "version": "1.0" }, "last_serial": 2523000, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "786b65dd14bd199c1a795088cb2056a1", "sha256": "1b3262c0c6ca0b3afc7de1049314e35ce2573992ef214a657a1c891d0b53a95c" }, "downloads": -1, "filename": "salesforce-bulkipy-1.0.tar.gz", "has_sig": false, "md5_digest": "786b65dd14bd199c1a795088cb2056a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10446, "upload_time": "2016-12-15T13:18:45", "url": "https://files.pythonhosted.org/packages/0b/12/cf8cb903f38fcb37b26703ddd105b56fdef30a58d0c4a2f4f912bcc09d7c/salesforce-bulkipy-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "786b65dd14bd199c1a795088cb2056a1", "sha256": "1b3262c0c6ca0b3afc7de1049314e35ce2573992ef214a657a1c891d0b53a95c" }, "downloads": -1, "filename": "salesforce-bulkipy-1.0.tar.gz", "has_sig": false, "md5_digest": "786b65dd14bd199c1a795088cb2056a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10446, "upload_time": "2016-12-15T13:18:45", "url": "https://files.pythonhosted.org/packages/0b/12/cf8cb903f38fcb37b26703ddd105b56fdef30a58d0c4a2f4f912bcc09d7c/salesforce-bulkipy-1.0.tar.gz" } ] }