【发布时间】:2019-08-02 10:25:43
【问题描述】:
我想使用 python 将 n1ql 的结果插入到存储桶“测试”中,但我不知道该怎么做,我是新手。
我使用 couchbase 搜索了文档 python SDK,但没有找到我正在努力解决的问题的答案。我不知道如何使用 upsert() 来解决这个问题..
from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator
from couchbase.n1ql import N1QLQuery
cluster = Cluster('couchbase://localhost:8091')
authenticator = PasswordAuthenticator('Administrator', 'root123')
cluster.authenticate(authenticator)
cb = cluster.open_bucket('test')
cb = cluster.open_bucket('pth')
cb.operationTimeout = 5000;
#N1QL Simple Query#
query = N1QLQuery("SELECT usr_id,score FROM pth ")
我希望将结果放入存储桶“测试”中。
【问题讨论】: