Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-6239

Views Examples for Python SDK (and others?)

    XMLWordPrintable

Details

    Description

      This page doesn't include cluster authentication. The samples should start with the following:

      START_CODE
      from couchbase.cluster import Cluster
      from couchbase.cluster import PasswordAuthenticator

      cluster = Cluster('couchbase://localhost')
      authenticator = PasswordAuthenticator('username', 'password')
      cluster.authenticate(authenticator)

      bucket = cluster.open_bucket('beer-sample')
      END_CODE

      Another problem is the changes we introduced to beer-sample bucket over time. There is only one design document there now, and it doesn't have "by_name" view any longer. So the code sample should use the only view that makes sense now, "brewery_beers", like below:

      START_CODE
      results = bucket.query('beer', 'brewery_beers')
      for row in results:
      print(row)
      END_CODE

      We should also use Python3 syntax, since Python2 is deprecated now.

      Attachments

        Issue Links

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

          Activity

            People

              jared.casey Jared Casey
              oleg.kuzmin Oleg Kuzmin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty