Hi,
My couchbase version is - 4.5.0-2601 Community Edition (build-2601)
The Python SDK version is - 2.2.6
OS = Linux ubuntucorei3 3.13.0-32-generic
I have a requirement for querying two PASSWORD PROTECTED buckets.
I tried the following Python code, which did not work:
Python Code [as per link - https://issues.couchbase.com/browse/PYCBC-377]
from couchbase.bucket import Bucket
from couchbase.n1ql import N1QLQuery
import connectionModule (custom module)
try:
bucket1 = connectionModule.bucket1BucketObj()
bucket1.add_bucket_creds(‘bucket1’, ‘password1’)
bucket1.add_bucket_creds(‘bucket2’, ‘password2’)
bucket1.cross_bucket = True
bucket1.adhoc = False
bucket1.consistency = ‘not_bounded’
search_sql = \
'''
SELECT ...
'''
query = N1QLQuery(search_sql)
for row in bucket1.n1ql_query(query):
print("bucket1Field = " + str(row['bucket1Field']))
print("bucket2Field = " + str(row['bucket2Field']))
except Exception as e:
raise
The exception is
File “/usr/local/lib/python3.4/dist-packages/couchbase/n1ql.py”, line 388, in iter
raw_rows = self.raw.fetch(self._mres)
couchbase.exceptions.HTTPError: <RC=0x3B[HTTP Operation failed. Inspect status code for details],
HTTP Request failed. Examine ‘objextra’ for full result, Results=1,
C Source=(src/http.c,140), OBJ=ViewResult<rc=0x3B[HTTP Operation failed.
Inspect status code for details], value={‘requestID’: ‘076399c4-aa2b-4a50-8e42-951dfcc956e3’,
‘metrics’: {‘errorCount’: 1, ‘executionTime’: ‘8.999034ms’, ‘resultSize’: 0, ‘elapsedTime’: ‘9.065921ms’, ‘resultCount’: 0},
‘errors’: [{‘code’: 10000, ‘msg’: ‘Authorization Failed Keyspace bucket2’}], ‘results’: [],
‘status’: ‘stopped’}, http_status=401>>
Queries:
- Is cross bucket querying available as per my couchbase & Python SDK vesrsions?
- If YES, can you please help me fix the above sample code or point me to a working example.
Regards,
Sachin Vyas.