skimhub / salesforce-python-toolkit

Automatically exported from code.google.com/p/salesforce-python-toolkit
GNU Lesser General Public License v3.0
0 stars 0 forks source link

SELECT COUNT() fails #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
result = sfdc.query('SELECT COUNT() FROM Lead')

results in 
File "/path/to/sforce/partner.py", line 148, in query
  queryResult.records = self._stringifyResultRecords(queryResult.records)

version 0.1.5, presumably affects all.

Original issue reported on code.google.com by dlanst...@gmail.com on 23 Jun 2011 at 6:00

GoogleCodeExporter commented 8 years ago
Workaround, extend and override the queryAll and query methods:

class MyPartnerClient(sforce.partner.SforcePartnerClient):
    def queryAll(self, queryString):
        queryResult = super(sforce.partner.SforcePartnerClient, self).queryAll(queryString)
        if queryResult.size > 0 and hasattr(queryResult,"records") and queryResult.records is not None:
            queryResult.records = self._stringifyResultRecords(queryResult.records)
        return queryResult

Original comment by ma...@cloudera.com on 16 Nov 2012 at 7:50