I am trying to execute a long running analytics query via the 3.0 sdk (I believe, would love to know definitive way to check).
I’ve verified the query works in the UI. I verified that short running analytics queries are working via the sdk.
I’m getting a timeout error (Error_1)
I don’t see an obvious way to up the timeout in the query options.
The docs don’t mention a timeout property on the AnalyticsOptions.
Thinking maybe AO extends regular query options I tried passing in a timeout: timedelta(minutes=20) and get Error_2.
Thinking maybe to use the raw
‘Escape hatch’ I pass in {timeout: timedelta} but crash getting a timedelta is not json serializable error.
Please help:
Error_1: (Timeout)
TimeoutException: <RC=0xC9[LCB_ERR_TIMEOUT (201)], HTTP Request failed. Examine ‘objextra’ for full result, Results=1, C Source=(src/pycbc_http.c,212), OBJ=ViewResult<rc=0xC9[LCB_ERR_TIMEOUT (201)], value=None, http_status=201, tracing_context=0, tracing_output=None>, Context={‘first_error_code’: 0, ‘http_response_code’: 0, ‘first_error_message’: ‘’, ‘statement’: ‘…’, ‘client_context_id’: ‘076869b7c3f18504’, ‘query_params’: ‘{“args”:[{“timeout”:null}],“metrics”:false,“statement”:"…’, ‘http_response_body’: ‘’, ‘endpoint’: ‘…:8095’, ‘type’: ‘AnalyticsErrorContext’}, Tracing Output={":nokey:0": null}>
Error_2: passing in timedelta as value to timeout property as docs say to do for standard query:
TypeError Traceback (most recent call last)
in
25
26
—> 27 result = cluster.analytics_query(query1, AnalyticsOptions(timeout=delta))
28 for row in result:
29 print(row)~/anaconda3/lib/python3.8/site-packages/couchbase/cluster.py in analytics_query(self, statement, *options, **kwargs)
665 return self._maybe_operate_on_an_open_bucket(CoreClient.analytics_query,
666 AnalyticsException,
–> 667 opt.to_query_object(statement, *opts, **kwargs),
668 itercls=itercls,
669 err_msg=‘Analytics queries require an open bucket’)~/anaconda3/lib/python3.8/site-packages/couchbase/options.py in to_query_object(self, statement, *options, **kwargs)
312 for k, v in ((k, args[k]) for k in (args.keys() & self.VALID_OPTS)):
313 for target, transform in self.VALID_OPTS[k].items():
–> 314 setattr(query, target, transform(v))
315 return query
316TypeError: ‘member_descriptor’ object is not callable