SqlForce
SQLForce turns Python into a powerful scripting language for manipulating a Salesforce database.
SQLForce:
- Installs using setuptools with a standard “python setup.py install” command.
- Supports ANSI-like INSERT, UPDATE, DELETE, and SELECT syntax, including SELECT DISTINCT, SELECT UNION, and INSERT … FROM SELECT.
- Overcomes Salesforce governor restrictions. For example:
- Salesforce limits UPDATE queries to 200 records per batch.
- SQLForce issues UPDATE operations 200 records at a time — without the SQLForce programmer having to care.
- Makes a natural bridge language between Salesforce and virtually any other data repository.
Most importantly, SQLForce saves a lot of time by replacing complex data import / export operations (using DataLoader or Excel) with short scripts.
For example, the following SQLForce script will normalize all Contact.MailingCountry records to use “USA” instead of “US”, “U.S.”, etc…
import SQLForce
session = SQLForce.Session(‘Production’, ‘MyUserName@me.com‘, ‘MyPassword’)
countryNames = [‘US’, ‘U.S.’, ‘United States’, ‘America’, ‘United States of America’]
session.runCommands(“UPDATE Contact SET MailingCountry=’USA’ WHERE MailingCountry IN (‘” + “‘,'”.join(countryNames) + “‘)” )