Search code examples
pythonversioncouchbase

How to obtain Couchbase Server version using the Couchbase Python SDK?


I'm trying to get Couchbase Server version using the Couchbase Python SDK.

I can do this using couchbase-cli but I need to get this information using Python.

I tried to use following code but returned AttributeError: 'Cluster' object has no attribute 'raw_result'

from couchbase.result import ClusterInfoResult as cir 

version = cir(cluster).server_version_full

Solution

  • You can get the Couchbase server version by calling the cluster_info() on the cluster object in SDK v4.1.

    cluster.cluster_info().server_version_full

    Reference: https://docs.couchbase.com/sdk-api/couchbase-python-client/couchbase_api/couchbase_core.html#couchbase.cluster.Cluster.cluster_info