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

Python SDK Documentation could use example of upsert involving JSON text

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.3.4
    • None
    • docs
    • None

    Description

      I have a Python script that retrieves JSON documents from Google AppEngine and needs to upsert them into a Couchbase bucket. The documentation on 'upsert', found here:

      https://developer.couchbase.com/documentation/server/current/sdk/python/start-using-sdk.html

      provides an example of 'upsert' using Python objects, e.g., 

      cb.upsert('u:king_arthur', {'name': 'Arthur', 'email': 'kingarthur@couchbase.com', 'interests': ['Holy Grail', 'African Swallows']})

      The more detailed API documentation, found here:

      http://pythonhosted.org/couchbase/api/couchbase.html

      Also uses Python objects. But there is no example showing me what to do if I have a string of JSON. What I'd like to see is something like:

      JSONstr = "{\"key1\": \"value1\", \"key2\": 123}"

      JSONobj = json.loads(JSONstr)

      cb.upsert("documentID",JSONobj)

       

      Attachments

        For Gerrit Dashboard: PYCBC-451
        # Subject Branch Project Status CR V

        Activity

          People

            Ellis.Breen Ellis Breen
            eben Eben Haber
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty