Hi,
Versions
- Couchbase Server 7.2
- couchbase==4.1.2(python package)
Question
Is there a way to bulk upsert to a couchbase bucket collection using the python SDK ?
Attempt
Currently upserting one document at a time.
def upsert_document(cb_coll: "couchbase.collection.Collection", doc: dict) -> None:
"""Upsert a document into the Couchbase collection."""
key = f"{doc['record_date']}_{doc['id']}"
try:
result = cb_coll.upsert(key, doc)
logger.info("Upserted document with CAS: %s", result.cas)
except Exception as e:
logger.error("Error upserting document: %s", e)