Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-179

Provide quiet=true semantics for insert/replace

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • .future
    • 1.0.0
    • docs
    • Security Level: Public

    Description

      The docs don't mention that add_multi will raise KeyExistsError for the last already existing key, if any number of them already exist. If this is intentional behavior, mentioning it in the docs would be useful and that the KeyExistsError.all_results is where most people will need to look for the OperationResult list.

      This behavior seems odd for the API. Assuming there is not a connection/server error, always returning the OperationResult dict would be more intuitive and avoid the code pattern of:

      try:
      results = bucket.add_multi(keys)
      except KeyExistsError as e:

      1. ignore exception because I'm going to process the results anyway
        results = e.all_results
      1. now process/verify 'results'


      If add_multi always returned an OperationResult dict, the code would simply be:

      results = bucket.add_multi(keys)

      1. process/verify 'results' without the unnecessary exception

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ingenthr Matt Ingenthron
            manfre Michael Manfre
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty