I'm writing Tornado application and need to make async N1QL queries. For map-reduce views using txcouchbase (twisted couchbase library) along with tornado-twisted bridge worked fine, but I can't do the same for N1QL queries.
...
from txcouchbase.bucket import Bucket as AsyncBucket
ASYNC_USER_BUCKET = AsyncBucket(**settings.USER_BUCKET_ARGS)
class FooHandler(BaseAPIHandler):
@schema.validate()
@authenticated
@coroutine
def get(self):
res = yield ASYNC_USER_BUCKET.n1qlQueryAll("SELECT * FROM farm_user;")
...
After executing following query res
object is not iterable and looks like this.
Seems that _BatchedRowMixin__rows
field contains the results of the query, but I'm not sure this is the right and stable way of making async N1QL queries. Are there any other options?
It appears you've identified a bug in our client. It has been filed as https://issues.couchbase.com/browse/PYCBC-306. Our code-review has a patch up which should be merged soon (http://review.couchbase.org/#/c/56402/).