code: def query_all(self, query, **kwargs):
          
          # Make the initial query to Salesforce
          response = self.query(query, **kwargs)
  
          # get fields
          fields = get_soql_fields(query)
  
          # put fields and first page of results into a temp list to be written to TempFile
          tmp_list = [fields]
          tmp_list.extend(parse_results(fields, response))
  
          tmp_dir = luigi.configuration.get_config().get('salesforce', 'local-tmp-dir', None)
          tmp_file = tempfile.TemporaryFile(mode='a+b', dir=tmp_dir)
  
          writer = csv.writer(tmp_file)
          writer.writerows(tmp_list)
  
          # The number of results might have exceeded the Salesforce batch limit
          # so check whether there are more results and retrieve them if so.
  
          length = len(response['records'])
          while not response['done']:
              response = self.query_more(response['nextRecordsUrl'], identifier_is_url=True, **kwargs)
  
              writer.writerows(parse_results(fields, response))
              length += len(response['records'])
              if not length % 10000:
                  logger.info('Requested {0} lines...'.format(length))
  
          logger.info('Requested a total of {0} lines.'.format(length))
  
          tmp_file.seek(0)
          return tmp_file
docs: Returns the full set of results for the `query`. This is a
          convenience wrapper around `query(...)` and `query_more(...)`.
          The returned dict is the decoded JSON payload from the final call to
          Salesforce, but with the `totalSize` field representing the full
          number of results retrieved and the `records` list representing the
          full list of records retrieved.
  
          :param query: the SOQL query to send to Salesforce, e.g.
                     `SELECT Id FROM Lead WHERE Email = "waldo@somewhere.com"`