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

N1QL placeholders do not work.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.0.2
    • 2.0.1
    • library
    • Security Level: Public
    • None

    Description

      I would expect the results from a query to be the same if I use placeholders or not.

      #!/usr/local/bin/python
       
      from couchbase.bucket import Bucket
      from couchbase.n1ql import N1QLQuery
       
      cb = Bucket('couchbase://192.168.46.101,192.168.46.103/beer-sample')
       
      type = 'beer'
      q = N1QLQuery('SELECT COUNT(*) as beer FROM `beer-sample` WHERE type = $type', type=type)
      print q
      for row in cb.n1ql_query(q):
          print row
       
      q = N1QLQuery('SELECT COUNT(*) as beer FROM `beer-sample` WHERE type = \'beer\'')
      print q
      for row in cb.n1ql_query(q):
          print row
      

      Output:

      <N1QLQuery stmt={'$type': {'type': 'beer'}, 'statement': 'SELECT COUNT(*) as beer FROM `beer-sample` WHERE type = $type'} at 4559745232>
      {u'beer': 0}
      <N1QLQuery stmt={'statement': "SELECT COUNT(*) as beer FROM `beer-sample` WHERE type = 'beer'"} at 4559745424>
      {u'beer': 5891}
      

      Attachments

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

        Activity

          People

            mnunberg Mark Nunberg (Inactive)
            pvarley Patrick Varley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty