sqlforcesh is a simple command-line shell in python that uses the very excellent SQLForce library from Capstorm to provide a basic interface to Salesforce instances.
The interface is probably reasonably familiar to people who have used MySQL or Postgres databases before.
sqlforce> connect
sqlforce> select id from account where name='IBM';
ββββββββββββββββββββββ
β id β
ββββββββββββββββββββββ€
β 0018000000RA0HjAAL β
β 0018000000vT6ExAAK β
ββββββββββββββββββββββ
2 records
sqlforce> select count() from contact where account.BillingCountry='USA'
1238 records
sqlforce> describe Payment__c
ββββββββββββββββββββββββββ¬ββββββββββββ
β Field Name β Type β
ββββββββββββββββββββββββββΌββββββββββββ€
β CreatedById β reference β
β CreatedDate β datetime β
β Duration__c β double β
β Expiration_Date__c β date β
β Grace_Period__c β double β
β Id β id β
β IsDeleted β boolean β
β LastActivityDate β date β
β LastModifiedById β reference β
β LastModifiedDate β datetime β
β License_Master__c β reference β
β Lock_Out_Date__c β date β
β Name β string β
β Renewal_Opportunity__c β reference β
β Renewal_Price__c β currency β
β Start_Date__c β date β
β Status__c β string β
β SystemModstamp β datetime β
ββββββββββββββββββββββββββ΄ββββββββββββ
sqlforce>
-
Because Cmd(2) implements output redirection using the greater-than symbol, sqlforcesh instead expects you to use modified constructs in your queries:
Instead of: Use this: To mean: <> != not equal to < lt less than | gt | greater than<= | le | less than or equal
= | ge | greater than or equal
SQLForce used to include such a shell in its distribution, but recent versions no longer include it. Since I have come to rely on using the shell for various "quick and dirty" queries and updates, I've created this as a replacement.
This code is not particularly elegant or clever, but if it works that's what I consider important.
Currently this needs the SQLForce package and terminaltables python module.
There is a sample config in sqlforcesh.ini-default and sqlforceshrc-default. The script looks for
them in your home directory. I built (and use) this on Linux, so Windows and Mac users are welcome to
adjust as needed.