The best way is to use SOQL, a SQL like language adopted for Salesforce to query its objects. An even better way is to use a wrapper which combines the power of a scripting language like Python with SOQL.
In fact I use SQLForceForJython, an opensource tool which you can easily integrate with a Jython script. The process is very simple:
- Download the most recent sqlforce.zip distribution.
- Add sqlforce.jar to your java CLASSPATH
- Import the SQLForce module
The following is a script I use to export the Contact table (to be precise, we refer to it as Object in Salesforce):
import SQLForce session = SQLForce.Session() session.connect( "PRODUCTION", "james@ttard.info", "password", "security-token" ) for rec in session.selectRecords("SELECT LastName, FirstName, MailingCountry FROM Contact"): print rec.LastName, rec.FirstName, rec.MailingCountry
You can filter by the date column and query by a timestamp as you would normally do in SQL to simulate a daily export...
No comments:
Post a Comment