def _run_query(self, soql, mapping):
    self.logger.info('Creating bulk job for: {sf_object}'.format(**mapping))
    job = self.bulk.create_query_job(mapping['sf_object'], contentType='CSV')
    self.logger.info('Job id: {0}'.format(job))
    self.logger.info('Submitting query: {}'.format(soql))
    batch = self.bulk.query(job, soql)
    self.logger.info('Batch id: {0}'.format(batch))
    self.bulk.wait_for_batch(job, batch)
    self.logger.info('Batch {0} finished'.format(batch))
    self.bulk.close_job(job)
    self.logger.info('Job {0} closed'.format(job))
    conn = self.session.connection()
    for result_file in self._get_results(batch, job):
        self._import_results(mapping, result_file, conn)
def _run_query(self, soql, mapping):
    self.logger.info('Creating bulk job for: {sf_object}'.format(**mapping))
    job = self.bulk.create_query_job(mapping['sf_object'], contentType='CSV')
    self.logger.info('Job id: {0}'.format(job))
    self.logger.info('Submitting query: {}'.format(soql))
    batch = self.bulk.query(job, soql)
    self.logger.info('Batch id: {0}'.format(batch))
    self.bulk.wait_for_batch(job, batch)
    self.logger.info('Batch {0} finished'.format(batch))
    self.bulk.close_job(job)
    self.logger.info('Job {0} closed'.format(job))
    conn = self.session.connection()
    for result_file in self._get_results(batch, job):
        self._import_results(mapping, result_file, conn)