simple-salesforce bulk upsert not working as expected

1.1k views Asked by At

I am trying to bulk upsert records into Salesforce using the simple-salesforce Python library.

I have a list of dictionaries called categories with the format [{'FooNumber': '001', 'Category': 'A'}, {'FooNumber': '002', 'Category': 'B'}, {'FooNumber': '003', 'Category': 'C'}...]

When I try upsert with one record at a time it works:

sf.Foo.upsert('FooNumber/001', {'Category': 'A'})

According to the documentation, the following bulk upsert code should work:

sf.bulk.Foo.upsert(scores, 'FooNumber', batch_size=1000)

But, I get the following error:

TypeError: upsert() got an unexpected keyword argument 'batch_size'

What is wrong with bulk upsert?

Note: I cannot make the code reproducible since I am working with private data.

1

There are 1 answers

0
David Reed On BEST ANSWER

Most likely, you need to update your simple_salesforce. This capability was added in simple_salesforce 1.1.0, the latest release.