覆盖输出到CSV文件

时间:2018-11-15 00:21:08

标签: export-to-csv

我正在使用Salesforce Bulk Package登录和查询数据(批量)

job = bulk.create_query_job("User", contentType='CSV')
batch = bulk.query(job, "SELECT id, name FROM User limit 2")
bulk.close_job(job)
while not bulk.is_batch_done(batch):
   sleep(10)

for result in bulk.get_all_results_for_query_batch(batch):
    reader = csv.DictReader(result, encoding='utf-8')
    for row in reader:
        print(row)

以下内容的输出是     OrderedDict([[('Id','XXXXXXXXXXXXXX'),('Name',Test1')])     OrderedDict([[('Id','XXXXXXXXXXXXXX'),('Name','Walter Paul')])

如何将结果打印到CSV文件中?请帮助

0 个答案:

没有答案