Hi @0xef06b0 - I have provide a snippet that shows the two ways you can alter the query timeout. You can adjust the global query timeout and also set the timeout on a per-query basis. The timeout used will be the lower of the two.
Are you running the query on a collection? Could you provide actual query you are trying to run? Would be useful for us to see, especially if the same query works via the Web UI.
from datetime import timedelta
from couchbase.cluster import Cluster, ClusterOptions, ClusterTimeoutOptions, QueryOptions
from couchbase.auth import PasswordAuthenticator
def run_sample_code():
try:
host = "couchbase://localhost"
username = "Administrator"
pw = "password"
# default query timeout = 75s
options = ClusterTimeoutOptions(kv_timeout=timedelta(seconds=60),
query_timeout=timedelta(seconds=120))
cluster = Cluster(host, ClusterOptions(
PasswordAuthenticator(username, pw), timeout_options=options))
query_iter = cluster.query("SELECT * FROM `travel-sample` LIMIT 100")
for r in query_iter.rows():
print(f"Found row: {r}")
# if the timeout is set the in QueryOoptions, the
# timeout will be the lower between the global timeout
# timeout provided in the QueryOptions
q_opts = QueryOptions(timeout=timedelta(seconds=1))
query_iter = cluster.query("SELECT * FROM `travel-sample` LIMIT 10000", q_opts)
count = 0
for r in query_iter.rows():
count += 1
print(f"Got {count} rows")
except Exception:
import traceback
traceback.print_exc()
if __name__ == '__main__':
run_sample_code()