I am writing a Tornado application and need to create asynchronous N1QL queries. To display map-reducing views using txcouchbase (a twisted couchbase library) worked fine together with the tornado-twisted bridge , 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 the following query, the res
object is not iterable and looks as follows.
It seems that the field _BatchedRowMixin__rows
contains the results of the query, but I'm not sure if this is the correct and stable way to make async N1QL queries. Are there any other options?