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

            Здрасте  Oleg Kuzmin - thanks for the ticket.

            Note that Python 3.0 is not yet GA, so https://docs.couchbase.com/python-sdk/current/view-queries-with-sdk.html
            will take you to 2.5. Track the 3.0 Views page at DOC-5139

            .

            For 3.0 API there will be a new views page, like https://docs.couchbase.com/scala-sdk/1.0/howtos/view-queries-with-sdk.html

            Some time in Q1 we hope to have some UI enhancements, including 'view on GitHub',

            which would take you to the sample with the imports, like: https://github.com/couchbase/docs-sdk-scala/blob/release/1.0/modules/howtos/examples/Views.scala

            .

            I'll keep this ticket open for the "by_name" view issue. 

            richard.smedley Richard Smedley added a comment - Здрасте  Oleg Kuzmin  - thanks for the ticket. Note that Python 3.0 is not yet GA, so  https://docs.couchbase.com/python-sdk/current/view-queries-with-sdk.html will take you to 2.5. Track the 3.0 Views page at  DOC-5139 . For 3.0 API there will be a new views page, like  https://docs.couchbase.com/scala-sdk/1.0/howtos/view-queries-with-sdk.html Some time in Q1 we hope to have some UI enhancements, including 'view on GitHub', which would take you to the sample with the imports, like:  https://github.com/couchbase/docs-sdk-scala/blob/release/1.0/modules/howtos/examples/Views.scala . I'll keep this ticket open for the "by_name" view issue. 
            richard.smedley Richard Smedley added a comment - Jared Casey    Given the work in https://github.com/couchbase/docs-sdk-python/commit/5c1f7b9639366d4f0aa240765747ee61d9912e02 I think that you can close this ticket.

            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:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty