Closed
Description
- Package Name: azure-cosmos
- Package Version: 4.9.0
- Operating System: Mac OS X
- Python Version: Python 3.12
Describe the bug
I tried using code like this:
batch_operations = [
("upsert", tuple([session_item] + message_pair_items))
]
await container.execute_item_batch(batch_operations=batch_operations, partition_key=[entra_oid, session_id])
That results in an error in the SDK however ("operation" is undefined), arising from this code lacking "upsert"--
elif len(args) == 2:
if operation_type.lower() == "replace":
operation = {"operationType": "Replace",
"id": args[0],
"resourceBody": args[1]}
elif operation_type.lower() == "patch":
operation = {"operationType": "Patch",
"id": args[0],
"resourceBody": {"operations": args[1]}}
filter_predicate = kwargs.pop("filter_predicate", None)
if filter_predicate is not None:
operation["resourceBody"]["condition"] = filter_predicate
Mark says that the .NET SDK has equivalent functionality for upsert and delete. And if for some reason they dont work, the error should be better.