Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Python client

3 replies [Last post]
  • Login or register to post comments
Fri, 05/11/2012 - 01:27
cconrad
Offline
Joined: 05/11/2012
Groups: None

The couchbase client for Python 0.6.0 behaves different from what the documentation states and how other Couchbase/memcached clients behave. For example, VBucketAwareCouchbaseClient.get returns a tuple (array) of 3 values on success and throws an exception ("couchbase.couchbaseclient.MemcachedError: Memcached error #1: Not found") when the key doesn't exist on the server.

I am wondering if this is because the documentation is outdated or because the client still is in Beta? Am I supposed to work around the exception or is the final version going to inherit this behavior?

Top
  • Login or register to post comments
Tue, 11/20/2012 - 02:21
redleader
Offline
Joined: 11/20/2012
Groups: None

bump. Seeing the same thing in 2.0 with python client 0.8.

The documentation says "If the request key does not exist in the database then the returned value is null."
but:
MemcachedError: Memcached error #1: Not found

Top
  • Login or register to post comments
Fri, 11/30/2012 - 17:28
cconrad
Offline
Joined: 05/11/2012
Groups: None

To be fair, I kindof like this behavior. Throwing an exception is more Pythonic, as a dict would do the same if a key was not found. It also makes it possible to differentiate between a stored None and a missing key. On the other hand, this behavior might feel "wrong" to developers switching from other clients or environments.

Either way, I hope you guys decide whether you want to keep it and if so, please update the documentation :)

Top
  • Login or register to post comments
Mon, 12/03/2012 - 15:26
redleader
Offline
Joined: 11/20/2012
Groups: None

dict.get(key) returns none if key is not in dict though

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker