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

Cannot run Explain Queries via SDK

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.1.1
    • 4.1.0
    • None
    • None
    • 0
    • SDK49

    Description

      Hi,

      The EXPLAIN statements do not work via the Query(). I suspect that this has been the case since SDK 4.x as this was working on SDK 3.x. The statements work via Query Workbench.

      Code Snippet

      try:
          result = cluster.query(
              "EXPLAIN SELECT * FROM `travel-sample`.inventory.airport LIMIT 10",
              QueryOptions(metrics=True),
          )

          for row in result.rows():
              print(row)

          print(f"Query Execution time: {result.metadata().metrics().execution_time()}")

      except CouchbaseException as ex:
          print(ex)

      Error

      <ec=8, category=couchbase.common, message=parsing_failure (8), context=QueryErrorContext({'last_dispatched_to': '172.20.0.2:8093', 'last_dispatched_from': '172.20.0.3:48886', 'retry_attempts': 0, 'client_context_id': '', 'method': 'POST', 'path': '/query/service', 'http_status': 400, 'http_body': '{\n"requestID": "fb83b9cd-7e63-4122-8a5c-85cd8d1b5c79",\n"errors": [

      Unknown macro: {"code"}

      ],\n"status": "fatal",\n"metrics": {"elapsedTime": "288.805µs","executionTime": "230.933µs","resultCount": 0,"resultSize": 0,"serviceLoad": 4,"errorCount": 1}\n}\n', 'first_error_code': 3000, 'first_error_message': 'syntax error - at EXPLAIN', 'statement': 'EXPLAIN SELECT * FROM `travel-sample`.inventory.airport LIMIT 10', 'parameters': '{"auto_execute":true,"client_context_id":"","statement":"PREPARE EXPLAIN SELECT * FROM `travel-sample`.inventory.airport LIMIT 10","timeout":"74500ms"}', 'context_type': 'QueryErrorContext'}), C Source=/home/ec2-user/workspace/python/sdk/python-manylinux-wheel-pipeline/couchbase-python-client/src/n1ql.cxx:323>

      Attachments

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

        Activity

          People

            jared.casey Jared Casey
            nithish.raghunandanan Nithish Raghunandanan
            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