Building on the solid foundations of the 1.2 series, the new Python 2.0 (beta) client comes with an updated API and some additional features.

 

To try out the new beta, simply use the pip tool:

 

 

In this release, I've modified the API to be more similar to that of our other SDKs. New verbs like upsert, insert, and counter now replace set, add and incr/decr, respectively. I know lots of you are still using the old method names, and those are still supported (though you may get a deprecation warning).

 

The Connection class has now been renamed to Bucket, and creating a new Bucket is now done though simply calling the constructor directly. The constructor is passed a connection string common to our SDKs. The connection string is passed directly to the C library, allowing you to set any option supported by the underlying library itself. Additionally, the connection string allows the ability to connect to Couchbase via SSL. Simply supply the couchbases:// scheme, and specify the path to the certificate via the certpath parameter.j

 

Finally, I've added improved support and integration for the unofficial couchbase-python-cffi module. This module allows you to use the Python client under PyPy. The internals of the main couchbase module were moved around a bit to allow for better integration. Internally, the couchbase-python-cffi module completely replaces the extension library and the rest of the components from the couchbase module end up building on an implementation-neutral subsystem. This allows, among other things, to use the txcouchbase module on pypy – something many of you have asked me about.

Author

Posted by Mark Nunberg, Software Engineer, Couchbase

Mark Nunberg is a software engineer working at Couchbase. He maintains the C client library (libcouchbase) as well as the Python client. He also developed the Perl client (for use at his previous company) - which initially led him to working at Couchbase. Prior to joining Couchbase, he worked on distributed and high performance routing systems at an eCommerce analytics firm. Mark studied Linguistics at the Hebrew University of Jerusalem.

Leave a reply