I want to insert the result of a n1ql into a bucket 'test' using python, and I don't know how to, I'm new to this.
I searched into the documentation python SDK using couchbase but didn't find the answer of what I'm struggling with.I don't know how to use upsert() for that..
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 ")
I want to have the result into the bucket 'test'.
Use INSERT INTO SELECT statement. Example 8, 13-15 at https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/insert.html