Python acouchbase: Multi methods missing


I’m using the acouchbase interface for asyncio. I noticed that the multi methods (get_multi() etc.) are missing in acouchbase. My workaround would be to use asyncio.gather(*[bucket.get(doc_id) for doc_id in doc_ids]).
Does couchbase SDK batch the requests in this case? In some cases, I load 1000s of documents in my app. If this resulted in 1000s of requests, this wouldn’t be great.
If the SDK doesn’t batch the requests: Is there any estimation on when get_multi() etc. will be available in acouchbase?

Thank you in advance!

get_multi has been dropped from the synchtonous version of the apis.
get_multi did not batch requests as each request is sent to the data node where the document resides. By processing the requests asynchronously, they are processed concurrently instead of serially.

ok, thank you very much for the quick reply! I’ll go with the aio.gather solution then.

Hi @foobar123 - I would like to clarify in case others view this post: The 4.x version of the Python SDK has not dropped multi-methods for the synchronous couchbase API. The 4.x version of the Python SDK only dropped multi-methods for the asynchronous APIs (acouchbase and txcouchbase) as each of those APIs are built with libraries that have mechanisms to handle multi operations (asyncio - asyncio.gather, twisted - DeferredList).

1 Like

@jcasey thanks for the clarification :slight_smile:
I think it would be very useful if you included this info in the python sdk docs (which in general are super helpful and comprehensive, btw)

1 Like

Good point! I can fairly quickly get some notes on the migration guide and API docs. I will talk w/ the docs team to see what we can do about providing docs to the multi-methods as the Python SDK is not the only SDK to offer those. We still have some work in better defining the functionality of the multi-method APIs, but we should be able to do something to better help steer users in the correct direction.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.