尝试通过启用pk_chunking = True来读取salesforce中的帐户表时,得到错误
salesforce_bulk.salesforce_bulk.BulkBatchFailed:作业的批次7511M00000KiqGsQAJ无失败:无
我查看了salesforce监控,pk_chunking
创建了11个批次,除上述情况外,所有批次均具有结果,并且它们的请求类似于
select Id from Account where Id >='' and Id<'' "
这是我写的代码:
table_names = ['Account','table1']
bulk = connect_sfdc_bulk('prod')
for x in table_names:
job = bulk.create_query_job(x, contentType='CSV', pk_chunking=True)
batch = bulk.query(job, "select Id from %s" % x)
print(bulk.get_batch_list(job))
print('batch status: ' , bulk.is_batch_done)
while not bulk.is_batch_done(batch):
time.sleep(6)
for result in bulk.get_all_results_for_query_batch(batch):
result = unicodecsv.DictReader(result, encoding='utf-8')
# print(result)
bulk.close_job(job)
请建议如何解决此错误,并并行从批处理中读取来自salesforce的大表?
答案 0 :(得分:0)
我遇到了同样的错误,我的解决方法是在get_all_results_for_query_batch(batch, Job )中添加“ job”参数
所以代码将是这样
table_names = ['Account','table1']
bulk = connect_sfdc_bulk('prod')
for x in table_names:
job = bulk.create_query_job(x, contentType='CSV', pk_chunking=True)
batch = bulk.query(job, "select Id from %s" % x)
print(bulk.get_batch_list(job))
print('batch status: ' , bulk.is_batch_done)
while not bulk.is_batch_done(batch):
time.sleep(6)
for result in bulk.get_all_results_for_query_batch(batch,job):
result = unicodecsv.DictReader(result, encoding='utf-8')
# print(result)
bulk.close_job(job)