the starter Code form Python SDK Docs throw an error for an “open Bucket” and Network Exceptions.
Code:
from couchbase.cluster import Cluster, ClusterOptions, QueryOptions
from couchbase_core.cluster import PasswordAuthenticator
cluster = Cluster('couchbase://CouchbaseServer.com', ClusterOptions(PasswordAuthenticator('username', 'password')))
cb = cluster.bucket('app')
cb_coll = cb.default_collection()
#cluster.query_indexes().create_primary_index('app')
row_iter = cluster.query('SELECT name FROM app WHERE $1 IN interests', QueryOptions(positional_parameters=['African Swallows']))
for row in row_iter: print(row)
Error :
Traceback (most recent call last):
File "/home/vm/text1.py", line 10, in <module>
row_iter = cluster.query('SELECT name FROM app WHERE $1 IN interests', QueryOptions(positional_parameters=['African Swallows']))
File "/home/vm/.local/lib/python3.6/site-packages/couchbase/cluster.py", line 609, in query
err_msg="Query requires an open bucket")
File "/home/vm/.local/lib/python3.6/site-packages/couchbase/cluster.py", line 624, in _maybe_operate_on_an_open_bucket
if self._is_6_5_plus():
File "/home/vm/.local/lib/python3.6/site-packages/couchbase/cluster.py", line 555, in _is_6_5_plus
response = self._admin.http_request(path="/pools").value
File "/home/vm/.local/lib/python3.6/site-packages/couchbase/management/admin.py", line 165, in http_request
timeout=timeout)
couchbase.exceptions.TimeoutException: <Key='/pools', RC=0xC9[LCB_ERR_TIMEOUT (201)], HTTP Request failed. Examine 'objextra' for full result, Results=1, C Source=(src/pycbc_http.c,212), OBJ=HttpResult<rc=0xC9[LCB_ERR_TIMEOUT (201)], value=None, http_status=0, url=/pools, tracing_context=0, tracing_output=None>, Context={'response_code': 0, 'path': '/pools', 'response_body': '', 'endpoint': 'CouchbaseServer.com:8091', 'type': 'HTTPErrorContext'}, Tracing Output={":nokey:0": null}>
I read the python SDK docs for this but didnt find anything which can help to solve this error.
The Document already exists in bucket on Server. Also i cant use CRUD operations.
Whats causing this?
Environment:
ubuntu 18 64-bit
Python 3.6.9
Couchbase Server 6.5 CE
Python SDK 3.0
Also if im creating an index while the script
Could someone point me out how to solved it or any Docs that can work.
thank you