Queries larger than the batch size fail when processing queryMore results

Bug #320695 reported by Kevin Shuk
16
Affects Status Importance Assigned to Milestone
pyax
Fix Committed
High
Kevin Shuk

Bug Description

It appears that queryMore runs the QueryResult through unpackomatic before returning the results to __processQueryResult which subsequently passes the value to unpackomatic again via __unpackQueryResult. queryMore should defer to the calling method to process the raw QueryResult structure.

Revision history for this message
Kevin Shuk (surf) wrote :

Found and confirmed as a large query test suite was built.

Changed in pyax:
assignee: nobody → surf
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Kevin Shuk (surf) wrote :

Committed to trunk rev 65

Changed in pyax:
status: Confirmed → Fix Committed
Revision history for this message
Ray C Horn (mrpython94596) wrote :

It is my feeling a reasonable fix would look something like this:

    def __processQueryResult(self, query_result):
        """ processes the result from a query or queryAll call into an
        Batch, calling queryMore as necessary to complete the query
        operation

        @param query_result: return result from a query or queryAll call
        @note: Although queryMore also returns a query_result this is not
            intended to be a primary input to this method. Rather, these are
            handled internally to this method and aggregated into the
            query_result_batch

        @return: a Batch populated with the sobject(s) found by the
            query call that produced the query_result parameter.
        @rtype: pyax.sobject.batch.Batch
        """
        sobject_records, done, query_locator = self._unpackQueryResult(query_result)
        sobject_records = sobject_records if (isinstance(sobject_records,list)) else [sobject_records]
        while done is False:
            query_result = self.__queryMore(query_locator)
            done = query_result['done']
            records = query_result['records']
            query_locator = query_result['queryLocator']
            sobject_records.extend(records)

        query_result_batch = self.__resultToObject(sobject_records)
        if (done is True) and (len(query_result_batch) == 0):
            query_result_batch = {'result':dict([(k,query_result[k]._dir) for k in query_result.keys()])}
        return query_result_batch

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.