Hi @deivydaslipskis - We do not officially support Ubuntu 22.04 yet, but the more recent versions of the SDK should work w/ that OS. You can check out the compatibility docs for the 3.0 SDK series here.
When working with an SDK that is compliant with an SDK API >= 3.0, you need to do KV operations from a collection object. Even if you are not using collections. See the CRUD operation docs here. The full example can be found on Github here. I have included a small snippet of the doc’s example below.
from acouchbase.cluster import Cluster, get_event_loop
from couchbase.cluster import ClusterOptions
from couchbase.auth import PasswordAuthenticator
async def get_couchbase():
cluster = Cluster(
"couchbase://localhost",
ClusterOptions(PasswordAuthenticator("Administrator", "password")))
bucket = cluster.bucket("travel-sample")
await bucket.on_connect()
return cluster, bucket
async def kv_operations(collection):
key = "hotel_10025"
res = await collection.get(key)
hotel = res.content_as[dict]
print("Hotel: {}".format(hotel))
hotel["alias"] = "Hostel"
res = await collection.upsert(key, hotel)
print("CAS: {}".format(res.cas))
# handle exception
try:
res = await collection.get("not-a-key")
except DocumentNotFoundException as ex:
print("Document not found exception caught!")
loop = get_event_loop()
cluster, bucket = loop.run_until_complete(get_couchbase())
# get a reference to the default collection, required for older Couchbase server versions
cb_coll_default = bucket.default_collection()
loop.run_until_complete(kv_operations(cb_coll))